@pisell/pisellos 2.1.119 → 2.1.121
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 +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/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/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 +58 -1
- package/dist/modules/Order/index.js +796 -29
- package/dist/modules/Order/types.d.ts +144 -12
- package/dist/modules/Order/utils.d.ts +28 -0
- package/dist/modules/Order/utils.js +250 -1
- package/dist/modules/Product/index.d.ts +1 -1
- 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.js +4 -1
- 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/utils.d.ts +3 -3
- package/dist/modules/Summary/utils.js +4 -4
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- 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/VenueBooking/index.d.ts +163 -0
- package/dist/solution/VenueBooking/index.js +2931 -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 +203 -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/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 +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 +49 -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/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 +58 -1
- package/lib/modules/Order/index.js +437 -1
- package/lib/modules/Order/types.d.ts +144 -12
- package/lib/modules/Order/utils.d.ts +28 -0
- package/lib/modules/Order/utils.js +250 -2
- package/lib/modules/Product/index.d.ts +1 -1
- 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.js +4 -1
- 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/utils.d.ts +3 -3
- package/lib/modules/Summary/utils.js +4 -4
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- 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/VenueBooking/index.d.ts +163 -0
- package/lib/solution/VenueBooking/index.js +1578 -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 +208 -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
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
{
|
|
2
|
+
"order_id": null,
|
|
3
|
+
"order_id__comment": "订单 ID;int/null;↕;创建时可为 null,更新时传已有订单 ID。",
|
|
4
|
+
"order_number": "A00123",
|
|
5
|
+
"order_number__comment": "系统订单号;string;←;服务端生成返回。",
|
|
6
|
+
"shop_order_number": "A00123",
|
|
7
|
+
"shop_order_number__comment": "商户订单号;string;←;服务端生成返回。",
|
|
8
|
+
"type": "appointment_booking",
|
|
9
|
+
"type__comment": "订单类型;string;↕;必填。示例:appointment_booking / ticket / virtual。",
|
|
10
|
+
"business_code": "appointment_booking",
|
|
11
|
+
"business_code__comment": "业务编码;string;↕;可选。",
|
|
12
|
+
"platform": "pos",
|
|
13
|
+
"platform__comment": "来源平台;string;↕;必填。示例:shop / pos / kiosk / h5 / app / mini-program。",
|
|
14
|
+
"sales_channel": "my_pisel",
|
|
15
|
+
"sales_channel__comment": "销售渠道;string;↕;必填。",
|
|
16
|
+
"order_sales_channel": "pos",
|
|
17
|
+
"order_sales_channel__comment": "订单销售渠道;string;↕;必填。",
|
|
18
|
+
"status": "normal",
|
|
19
|
+
"status__comment": "订单状态;string;←;服务端返回。文档说明示例:open / completed / cancelled。",
|
|
20
|
+
"payment_status": "payment_processing",
|
|
21
|
+
"payment_status__comment": "支付状态;string;↕;可选。具体枚举见服务端定义。",
|
|
22
|
+
"shipping_status": "unfulfilled",
|
|
23
|
+
"shipping_status__comment": "发货状态;string;←;服务端返回。",
|
|
24
|
+
|
|
25
|
+
"customer_id": 456,
|
|
26
|
+
"customer_id__comment": "客户 ID;int;↕;必填。设备端用该 ID 从本地客户基准数据取详情。",
|
|
27
|
+
"customer_name": "张三",
|
|
28
|
+
"customer_name__comment": "客户名称;string;↕;可选。",
|
|
29
|
+
"country_calling_code": "+86",
|
|
30
|
+
"country_calling_code__comment": "国家呼号;string;↕;可选。",
|
|
31
|
+
"phone": "13800138000",
|
|
32
|
+
"phone__comment": "手机号;string;↕;可选。",
|
|
33
|
+
"email": "zhang@example.com",
|
|
34
|
+
"email__comment": "邮箱;string;↕;可选。",
|
|
35
|
+
|
|
36
|
+
"is_price_include_tax": 1,
|
|
37
|
+
"is_price_include_tax__comment": "是否含税;int(0/1);↕;必填。",
|
|
38
|
+
"tax_title": "GST",
|
|
39
|
+
"tax_title__comment": "税种名称;string;↕;必填。",
|
|
40
|
+
"tax_country_code": "MY",
|
|
41
|
+
"tax_country_code__comment": "税种国家编码;string;↕;必填。",
|
|
42
|
+
"currency_code": "MYR",
|
|
43
|
+
"currency_code__comment": "货币编码;string;↕;必填。",
|
|
44
|
+
"currency_symbol": "RM",
|
|
45
|
+
"currency_symbol__comment": "货币符号;string;↕;必填。",
|
|
46
|
+
"currency_format": "symbol_first",
|
|
47
|
+
"currency_format__comment": "货币格式;string;↕;必填。",
|
|
48
|
+
|
|
49
|
+
"is_deposit": 0,
|
|
50
|
+
"is_deposit__comment": "是否收取定金;int(0/1);↕;必填。",
|
|
51
|
+
"deposit_amount": "0.00",
|
|
52
|
+
"deposit_amount__comment": "定金金额;string;↕;必填。",
|
|
53
|
+
"shop_discount": "0.00",
|
|
54
|
+
"shop_discount__comment": "整单优惠金额;string;↕;必填。",
|
|
55
|
+
"surcharge_fee": "10.00",
|
|
56
|
+
"surcharge_fee__comment": "附加费总额;string;↕;必填。",
|
|
57
|
+
"note": "客人要求安静包房",
|
|
58
|
+
"note__comment": "订单备注;string;↕;可选。",
|
|
59
|
+
"schedule_date": "2026-03-18 00:00:00",
|
|
60
|
+
"schedule_date__comment": "预约日期;datetime;↕;必填。",
|
|
61
|
+
"created_at": "2026-03-18 10:00:00",
|
|
62
|
+
"created_at__comment": "创建时间;datetime;↕;必填。",
|
|
63
|
+
|
|
64
|
+
"products": [
|
|
65
|
+
{
|
|
66
|
+
"order_detail_id": 789,
|
|
67
|
+
"order_detail_id__comment": "订单明细 ID;int/null;↕;创建时可为 null,更新时传。",
|
|
68
|
+
"product_id": 101,
|
|
69
|
+
"product_id__comment": "商品 ID;int/null;↕;null 表示自定义商品。",
|
|
70
|
+
"num": 2,
|
|
71
|
+
"num__comment": "数量;int;↕;必填。统一使用 num,不再使用 product_quantity。",
|
|
72
|
+
"product_variant_id": 0,
|
|
73
|
+
"product_variant_id__comment": "多规格 ID;int;↕;可选。",
|
|
74
|
+
"product_option_item": [],
|
|
75
|
+
"product_option_item__comment": "选项配置;array;↕;可选。",
|
|
76
|
+
"selling_price": "50.00",
|
|
77
|
+
"selling_price__comment": "销售单价(交易快照);string;←;服务端返回,不能依赖基准数据回填。",
|
|
78
|
+
"original_price": "60.00",
|
|
79
|
+
"original_price__comment": "原价(交易快照);string;←。",
|
|
80
|
+
"payment_price": "50.00",
|
|
81
|
+
"payment_price__comment": "实际支付单价(交易快照);string;←。",
|
|
82
|
+
"tax_fee": "5.00",
|
|
83
|
+
"tax_fee__comment": "商品税费;string;←。",
|
|
84
|
+
"is_charge_tax": 1,
|
|
85
|
+
"is_charge_tax__comment": "是否收税;int(0/1);←。",
|
|
86
|
+
"discount_list": [
|
|
87
|
+
{
|
|
88
|
+
"order_discount_id": 601,
|
|
89
|
+
"order_discount_id__comment": "折扣记录 ID;int/null;↕;更新时传。",
|
|
90
|
+
"type": "product",
|
|
91
|
+
"type__comment": "折扣类型;string;↕;示例:shop / product。",
|
|
92
|
+
"discount_id": 0,
|
|
93
|
+
"discount_id__comment": "关联折扣规则 ID;int;↕。",
|
|
94
|
+
"amount": "10.00",
|
|
95
|
+
"amount__comment": "折扣金额;string;↕。",
|
|
96
|
+
"discount": {},
|
|
97
|
+
"discount__comment": "折扣详情;object;↕。",
|
|
98
|
+
"metadata": {
|
|
99
|
+
"unique_identification_number": "local_disc_001"
|
|
100
|
+
},
|
|
101
|
+
"metadata__comment": "元数据;object;↕。"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"discount_list__comment": "商品折扣列表;array;↕;结构见当前数组示例。",
|
|
105
|
+
"product_bundle": [
|
|
106
|
+
{
|
|
107
|
+
"bundle_group_id": 1,
|
|
108
|
+
"bundle_group_id__comment": "套餐组 ID;int;↕。",
|
|
109
|
+
"bundle_id": 10,
|
|
110
|
+
"bundle_id__comment": "套餐商品 ID;int;↕。",
|
|
111
|
+
"bundle_variant_id": 0,
|
|
112
|
+
"bundle_variant_id__comment": "套餐商品规格 ID;int;↕。",
|
|
113
|
+
"num": 1,
|
|
114
|
+
"num__comment": "数量;number;↕。",
|
|
115
|
+
"extension_id": 0,
|
|
116
|
+
"extension_id__comment": "扩展 ID;int;↕。",
|
|
117
|
+
"extension_type": "",
|
|
118
|
+
"extension_type__comment": "扩展类型;string;↕。",
|
|
119
|
+
"option": [],
|
|
120
|
+
"option__comment": "选项;array;↕。"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"product_bundle__comment": "套餐子商品;array;↕;结构见当前数组示例。",
|
|
124
|
+
"metadata": {
|
|
125
|
+
"unique_identification_number": "local_prod_001"
|
|
126
|
+
},
|
|
127
|
+
"metadata__comment": "商品元数据;object;↕;通常包含 unique_identification_number。"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"products__comment": "订单级别商品数组;array;↕;非预约关联商品放这里。预约主商品在 bookings[].product 中。",
|
|
131
|
+
|
|
132
|
+
"bookings": [
|
|
133
|
+
{
|
|
134
|
+
"schedule_event_id": 301,
|
|
135
|
+
"schedule_event_id__comment": "子预约 ID;int/null;↕;更新时传。",
|
|
136
|
+
"booking_id": "B20260318001",
|
|
137
|
+
"booking_id__comment": "预约号;string;←;服务端生成。",
|
|
138
|
+
"appointment_status": "new",
|
|
139
|
+
"appointment_status__comment": "预约状态;string;←;示例:new / confirmed / arrived / started / completed / cancelled。",
|
|
140
|
+
|
|
141
|
+
"start_date": "2026-03-18",
|
|
142
|
+
"start_date__comment": "预定开始日期;string(Y-m-d);↕;必填。",
|
|
143
|
+
"start_time": "15:00",
|
|
144
|
+
"start_time__comment": "预定开始时间;string(H:i);↕;必填。",
|
|
145
|
+
"end_date": "2026-03-18",
|
|
146
|
+
"end_date__comment": "预定结束日期;string(Y-m-d);↕;必填。",
|
|
147
|
+
"end_time": "17:00",
|
|
148
|
+
"end_time__comment": "预定结束时间;string(H:i);↕;必填。",
|
|
149
|
+
"select_date": "2026-03-18",
|
|
150
|
+
"select_date__comment": "全天选择日期;string(Y-m-d);↕;必填。",
|
|
151
|
+
"duration": 120,
|
|
152
|
+
"duration__comment": "服务时长(分钟);int;↕;必填。",
|
|
153
|
+
"arrived_at": null,
|
|
154
|
+
"arrived_at__comment": "实际到店时间;datetime/null;←;新增字段。",
|
|
155
|
+
"completed_at": null,
|
|
156
|
+
"completed_at__comment": "实际结束时间;datetime/null;←;新增字段。",
|
|
157
|
+
|
|
158
|
+
"sub_type": "service",
|
|
159
|
+
"sub_type__comment": "子类型;string;↕;必填。",
|
|
160
|
+
"like_status": "common",
|
|
161
|
+
"like_status__comment": "特殊状态;string;↕;示例:common / like。",
|
|
162
|
+
"number": 1,
|
|
163
|
+
"number__comment": "预约人数/容量占用;int;↕;可选。",
|
|
164
|
+
|
|
165
|
+
"resources": [
|
|
166
|
+
{
|
|
167
|
+
"form_id": 10,
|
|
168
|
+
"form_id__comment": "表单 ID;int;↕;必填。",
|
|
169
|
+
"relation_type": "form",
|
|
170
|
+
"relation_type__comment": "关联类型;string;↕;必填。示例:form。",
|
|
171
|
+
"relation_id": 201,
|
|
172
|
+
"relation_id__comment": "关联资源 ID;int;↕;必填。设备端用该 ID 从本地基准数据取资源详情。",
|
|
173
|
+
"capacity": 1,
|
|
174
|
+
"capacity__comment": "占用容量;int;↕;必填。",
|
|
175
|
+
"like_status": "like",
|
|
176
|
+
"like_status__comment": "特殊状态;string;↕;可选。",
|
|
177
|
+
"metadata": null,
|
|
178
|
+
"metadata__comment": "资源元数据;object/null;↕;可选。",
|
|
179
|
+
"children": [
|
|
180
|
+
{
|
|
181
|
+
"form_id": 11,
|
|
182
|
+
"form_id__comment": "子资源表单 ID;int;↕。",
|
|
183
|
+
"relation_type": "form",
|
|
184
|
+
"relation_type__comment": "子资源关联类型;string;↕。",
|
|
185
|
+
"relation_id": 305,
|
|
186
|
+
"relation_id__comment": "子资源关联 ID;int;↕。",
|
|
187
|
+
"capacity": 1,
|
|
188
|
+
"capacity__comment": "子资源占用容量;int;↕。",
|
|
189
|
+
"metadata": null,
|
|
190
|
+
"metadata__comment": "子资源元数据;object/null;↕。"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"children__comment": "子资源数组;array;↕;组合资源场景使用,结构同父级。"
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"resources__comment": "预约关联资源数组;array;↕;只返回 ID,不返回资源名称/头像/技能等详情。",
|
|
197
|
+
|
|
198
|
+
"product": {
|
|
199
|
+
"order_detail_id": null,
|
|
200
|
+
"order_detail_id__comment": "预约主商品对应的订单明细 ID;int/null;↕。",
|
|
201
|
+
"product_id": 101,
|
|
202
|
+
"product_id__comment": "预约主商品 ID;int/null;↕。",
|
|
203
|
+
"num": 1,
|
|
204
|
+
"num__comment": "预约主商品数量;int;↕。",
|
|
205
|
+
"discount_list": [],
|
|
206
|
+
"discount_list__comment": "预约主商品折扣列表;array;↕;结构同 products[].discount_list。",
|
|
207
|
+
"product_bundle": [],
|
|
208
|
+
"product_bundle__comment": "预约主商品套餐子项;array;↕;结构同 products[].product_bundle。",
|
|
209
|
+
"metadata": {
|
|
210
|
+
"unique_identification_number": "local_bk_prod_001"
|
|
211
|
+
},
|
|
212
|
+
"metadata__comment": "预约主商品元数据;object;↕。"
|
|
213
|
+
},
|
|
214
|
+
"product__comment": "预约主商品对象;object;↕;结构与 products 单项一致。",
|
|
215
|
+
|
|
216
|
+
"relation_products": [],
|
|
217
|
+
"relation_products__comment": "预约附属商品数组;array;↕;结构同 products。",
|
|
218
|
+
"relation_forms": [],
|
|
219
|
+
"relation_forms__comment": "预约关联表单;array;↕。",
|
|
220
|
+
"holder": null,
|
|
221
|
+
"holder__comment": "预约主体参数;object/null;↕。",
|
|
222
|
+
"metadata": {
|
|
223
|
+
"unique_identification_number": "local_booking_001"
|
|
224
|
+
},
|
|
225
|
+
"metadata__comment": "预约元数据;object;↕;通常包含 unique_identification_number。"
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"bookings__comment": "预约数组;array;↕;每个 booking 对应一个子预约(schedule_event,parent_id != 0)。",
|
|
229
|
+
|
|
230
|
+
"payments": [
|
|
231
|
+
{
|
|
232
|
+
"order_payment_id": 501,
|
|
233
|
+
"order_payment_id__comment": "支付记录 ID;int/null;↕;存量数据传,新增时可为空。",
|
|
234
|
+
"custom_payment_id": 1,
|
|
235
|
+
"custom_payment_id__comment": "支付方式 ID;int;↕;设备端可用它从本地支付方式配置取详情。",
|
|
236
|
+
"code": "cash",
|
|
237
|
+
"code__comment": "支付方式编码;string;↕。",
|
|
238
|
+
"name": "现金",
|
|
239
|
+
"name__comment": "支付方式名称;string;↕。",
|
|
240
|
+
"type": "deposit",
|
|
241
|
+
"type__comment": "支付类型;string;↕;示例:deposit。",
|
|
242
|
+
"voucher_id": null,
|
|
243
|
+
"voucher_id__comment": "Wallet Pass ID;int/null;↕。",
|
|
244
|
+
"amount": "100.00",
|
|
245
|
+
"amount__comment": "支付金额;string;↕;必填。",
|
|
246
|
+
"origin_amount": "100.00",
|
|
247
|
+
"origin_amount__comment": "原始金额;string;←。",
|
|
248
|
+
"rounding_amount": "0.00",
|
|
249
|
+
"rounding_amount__comment": "Rounding 金额;string;←。",
|
|
250
|
+
"status": "paid",
|
|
251
|
+
"status__comment": "支付状态;string;↕;示例:paid / voided / payment_pending。",
|
|
252
|
+
"payment_time": "2026-03-18 15:00:00",
|
|
253
|
+
"payment_time__comment": "支付时间;datetime/null;←。",
|
|
254
|
+
"service_charge": null,
|
|
255
|
+
"service_charge__comment": "手续费配置;object/null;↕。",
|
|
256
|
+
"wallet_pass_usage_unit": null,
|
|
257
|
+
"wallet_pass_usage_unit__comment": "Wallet Pass 使用单位;array/null;↕。",
|
|
258
|
+
"wallet_pass_use_value": null,
|
|
259
|
+
"wallet_pass_use_value__comment": "Wallet Pass 使用值;number/null;↕。",
|
|
260
|
+
"metadata": {
|
|
261
|
+
"unique_payment_number": "local_pay_001"
|
|
262
|
+
},
|
|
263
|
+
"metadata__comment": "支付元数据;object;↕;通常包含 unique_payment_number。"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
"payments__comment": "支付数组;array;↕。",
|
|
267
|
+
|
|
268
|
+
"surcharges": [
|
|
269
|
+
{
|
|
270
|
+
"order_surcharge_id": 701,
|
|
271
|
+
"order_surcharge_id__comment": "订单附加费记录 ID;int/null;←;服务端返回。",
|
|
272
|
+
"surcharge_id": 1,
|
|
273
|
+
"surcharge_id__comment": "附加费配置 ID;int;↕;必填。",
|
|
274
|
+
"type": "service_charge",
|
|
275
|
+
"type__comment": "附加费类型;string;↕;必填。",
|
|
276
|
+
"name": {
|
|
277
|
+
"en": "Service Charge"
|
|
278
|
+
},
|
|
279
|
+
"name__comment": "名称;object;↕;多语言 JSON。",
|
|
280
|
+
"description": {
|
|
281
|
+
"en": "10% service charge"
|
|
282
|
+
},
|
|
283
|
+
"description__comment": "描述;object;↕;多语言 JSON。",
|
|
284
|
+
"percentage": "0.10",
|
|
285
|
+
"percentage__comment": "百分比费率;string/null;↕。",
|
|
286
|
+
"fixed": null,
|
|
287
|
+
"fixed__comment": "固定金额;string/null;↕。",
|
|
288
|
+
"amount": "10.00",
|
|
289
|
+
"amount__comment": "附加费金额;string;↕;必填。"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"surcharges__comment": "附加费数组;array;↕。",
|
|
293
|
+
|
|
294
|
+
"discount_list": [],
|
|
295
|
+
"discount_list__comment": "顶层整单折扣列表;array;↕;文档样例中出现于顶层结构,但详细字段说明主要在商品折扣部分,可按商品折扣结构复用。",
|
|
296
|
+
"relation_forms": [],
|
|
297
|
+
"relation_forms__comment": "顶层关联表单;array;↕。",
|
|
298
|
+
"contacts": [],
|
|
299
|
+
"contacts__comment": "联系人数组;array;↕;顶层结构中出现,但文档第四部分未单独展开字段定义。",
|
|
300
|
+
"contacts_info": [],
|
|
301
|
+
"contacts_info__comment": "联系人信息数组;array;↕;顶层结构中出现,但文档第四部分未单独展开字段定义。",
|
|
302
|
+
"holder": null,
|
|
303
|
+
"holder__comment": "顶层持有人/主体参数;object/null;↕;顶层结构中出现,但文档第四部分未单独展开字段定义。",
|
|
304
|
+
|
|
305
|
+
"summary": {
|
|
306
|
+
"product_quantity": 3,
|
|
307
|
+
"product_quantity__comment": "商品总数量;int;←。",
|
|
308
|
+
"product_original_amount": "180.00",
|
|
309
|
+
"product_original_amount__comment": "商品原价总额;string;←。",
|
|
310
|
+
"product_amount": "150.00",
|
|
311
|
+
"product_amount__comment": "商品实际支付总额;string;←。",
|
|
312
|
+
"product_expect_amount": "150.00",
|
|
313
|
+
"product_expect_amount__comment": "商品预计支付总额;string;←。",
|
|
314
|
+
"product_tax_fee": "15.00",
|
|
315
|
+
"product_tax_fee__comment": "商品总税费;string;←。",
|
|
316
|
+
"shipping_fee": "0.00",
|
|
317
|
+
"shipping_fee__comment": "运费;string;←。",
|
|
318
|
+
"shipping_tax_fee": "0.00",
|
|
319
|
+
"shipping_tax_fee__comment": "运费税;string;←。",
|
|
320
|
+
"tax_fee": "15.00",
|
|
321
|
+
"tax_fee__comment": "订单总税费;string;←。",
|
|
322
|
+
"surcharge_fee": "10.00",
|
|
323
|
+
"surcharge_fee__comment": "附加费总额;string;←。",
|
|
324
|
+
"discount_amount": "30.00",
|
|
325
|
+
"discount_amount__comment": "优惠总额;string;←。",
|
|
326
|
+
"deposit_amount": "0.00",
|
|
327
|
+
"deposit_amount__comment": "定金金额;string;←。",
|
|
328
|
+
"expect_amount": "175.00",
|
|
329
|
+
"expect_amount__comment": "预计总金额(不含手续费);string;←。",
|
|
330
|
+
"total_amount": "175.00",
|
|
331
|
+
"total_amount__comment": "订单总金额(实际应付);string;←。",
|
|
332
|
+
"amount_gap": "0.00",
|
|
333
|
+
"amount_gap__comment": "差额;string;←。",
|
|
334
|
+
"rounding_amount": "0.00",
|
|
335
|
+
"rounding_amount__comment": "Rounding 金额;string;←。",
|
|
336
|
+
"pay_service_charge_amount": "0.00",
|
|
337
|
+
"pay_service_charge_amount__comment": "支付手续费;string;←。"
|
|
338
|
+
},
|
|
339
|
+
"summary__comment": "金额汇总;object;←;仅输出,由服务端计算生成。设备端离线场景可本地按同算法计算。",
|
|
340
|
+
|
|
341
|
+
"metadata": {},
|
|
342
|
+
"metadata__comment": "扩展元数据;object;↕;顶层附加信息。"
|
|
343
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, DateModule, ScheduleModule, QuotationModule, OpenDataModule } from '../../modules';
|
|
2
|
+
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
|
+
export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
|
|
4
|
+
export declare enum VenueBookingHooks {
|
|
5
|
+
onInited = "venueBooking:onInited",
|
|
6
|
+
onDestroy = "venueBooking:onDestroy",
|
|
7
|
+
onRetryInit = "venueBooking:onRetryInit",
|
|
8
|
+
onRefresh = "venueBooking:onRefresh",
|
|
9
|
+
onCartValidationChanged = "venueBooking:onCartValidationChanged"
|
|
10
|
+
}
|
|
11
|
+
export type VenueBookingStatus = 'idle' | 'initializing' | 'ready' | 'error';
|
|
12
|
+
export interface VenueBookingEntryContext {
|
|
13
|
+
biz: string;
|
|
14
|
+
venueId?: string;
|
|
15
|
+
sourceOrderId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface VenueBookingConfig {
|
|
18
|
+
orderSource: 'local' | 'remote';
|
|
19
|
+
features: {
|
|
20
|
+
autoMerge: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface VenueBookingSlotConfig {
|
|
24
|
+
slotDurationMinutes: number;
|
|
25
|
+
businessStartTime: string;
|
|
26
|
+
businessEndTime: string;
|
|
27
|
+
fewLeftThreshold: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const DEFAULT_SLOT_CONFIG: VenueBookingSlotConfig;
|
|
30
|
+
export interface VenueTimeSlot {
|
|
31
|
+
startTime: string;
|
|
32
|
+
endTime: string;
|
|
33
|
+
status: 'available' | 'occupied' | 'partially_occupied' | 'past' | 'unavailable';
|
|
34
|
+
price: string | null;
|
|
35
|
+
resourceId: number | string;
|
|
36
|
+
resourceFormId: number | string;
|
|
37
|
+
capacity: number | null;
|
|
38
|
+
remainingCapacity: number | null;
|
|
39
|
+
}
|
|
40
|
+
export interface VenueResourceRow {
|
|
41
|
+
resourceId: number | string;
|
|
42
|
+
resourceFormId: number | string;
|
|
43
|
+
resourceName: string;
|
|
44
|
+
productId: number;
|
|
45
|
+
productTitle: string;
|
|
46
|
+
slots: VenueTimeSlot[];
|
|
47
|
+
}
|
|
48
|
+
export interface VenueTimeSlotGrid {
|
|
49
|
+
date: string;
|
|
50
|
+
timeLabels: string[];
|
|
51
|
+
resources: VenueResourceRow[];
|
|
52
|
+
}
|
|
53
|
+
export interface VenueDateSummaryItem {
|
|
54
|
+
date: string;
|
|
55
|
+
status: 'available' | 'few_left' | 'sold_out' | 'unavailable';
|
|
56
|
+
startingPrice: string | null;
|
|
57
|
+
totalSlots: number;
|
|
58
|
+
availableSlots: number;
|
|
59
|
+
}
|
|
60
|
+
export interface VenueResourceRawData {
|
|
61
|
+
resourceId: number | string;
|
|
62
|
+
formId: number | string;
|
|
63
|
+
main_field?: string;
|
|
64
|
+
form_id?: number | string;
|
|
65
|
+
resource_form_id?: number | string;
|
|
66
|
+
capacity?: number;
|
|
67
|
+
times: Array<{
|
|
68
|
+
start_at: string;
|
|
69
|
+
end_at: string;
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
}>;
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
}
|
|
74
|
+
export interface ResourceProductMapping {
|
|
75
|
+
productId: number;
|
|
76
|
+
productTitle: string;
|
|
77
|
+
resourceName: string;
|
|
78
|
+
formId: number | string;
|
|
79
|
+
price: string;
|
|
80
|
+
resourceType: 'single' | 'multiple' | 'capacity';
|
|
81
|
+
}
|
|
82
|
+
export interface VenueSlotSelection {
|
|
83
|
+
resourceId: number | string;
|
|
84
|
+
startTime: string;
|
|
85
|
+
endTime: string;
|
|
86
|
+
price: string;
|
|
87
|
+
}
|
|
88
|
+
export interface MergedSlotGroup {
|
|
89
|
+
startTime: string;
|
|
90
|
+
endTime: string;
|
|
91
|
+
totalPrice: string;
|
|
92
|
+
slotCount: number;
|
|
93
|
+
slots: VenueSlotSelection[];
|
|
94
|
+
}
|
|
95
|
+
export interface PriceBreakdownEntry {
|
|
96
|
+
start_time: string;
|
|
97
|
+
end_time: string;
|
|
98
|
+
unit_price: number;
|
|
99
|
+
quotation_shelf_id: number;
|
|
100
|
+
quantity: number;
|
|
101
|
+
}
|
|
102
|
+
export interface VenueBookingState {
|
|
103
|
+
entryContext: VenueBookingEntryContext | null;
|
|
104
|
+
status: VenueBookingStatus;
|
|
105
|
+
flow: Record<string, any>;
|
|
106
|
+
error: string | null;
|
|
107
|
+
products?: ProductList;
|
|
108
|
+
order?: OrderModule;
|
|
109
|
+
salesSummary?: SalesSummaryModule;
|
|
110
|
+
scanOrderLogger?: ScanOrderLoggerModule;
|
|
111
|
+
venueProducts?: ProductList;
|
|
112
|
+
addonProducts?: ProductList;
|
|
113
|
+
date?: DateModule;
|
|
114
|
+
schedule?: ScheduleModule;
|
|
115
|
+
quotation?: QuotationModule;
|
|
116
|
+
openData?: OpenDataModule;
|
|
117
|
+
rawResourceData: VenueResourceRawData[];
|
|
118
|
+
slotConfig: VenueBookingSlotConfig;
|
|
119
|
+
itemRuleQuantityLimits: QuantityLimitResult[];
|
|
120
|
+
cartValidation: {
|
|
121
|
+
passed: boolean | null;
|
|
122
|
+
failures: QuantityCheckResult[];
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export interface VenueBookingLoggerRuntimeConfig {
|
|
126
|
+
provider?: ScanOrderLoggerProviderType;
|
|
127
|
+
providerConfig?: ScanOrderLoggerProviderConfig;
|
|
128
|
+
}
|
|
129
|
+
export interface VenueBookingAddLogParams extends ScanOrderLogInput {
|
|
130
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/solution/VenueBooking/types.ts
|
|
20
|
+
var types_exports = {};
|
|
21
|
+
__export(types_exports, {
|
|
22
|
+
DEFAULT_SLOT_CONFIG: () => DEFAULT_SLOT_CONFIG,
|
|
23
|
+
VenueBookingHooks: () => VenueBookingHooks
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(types_exports);
|
|
26
|
+
var VenueBookingHooks = /* @__PURE__ */ ((VenueBookingHooks2) => {
|
|
27
|
+
VenueBookingHooks2["onInited"] = "venueBooking:onInited";
|
|
28
|
+
VenueBookingHooks2["onDestroy"] = "venueBooking:onDestroy";
|
|
29
|
+
VenueBookingHooks2["onRetryInit"] = "venueBooking:onRetryInit";
|
|
30
|
+
VenueBookingHooks2["onRefresh"] = "venueBooking:onRefresh";
|
|
31
|
+
VenueBookingHooks2["onCartValidationChanged"] = "venueBooking:onCartValidationChanged";
|
|
32
|
+
return VenueBookingHooks2;
|
|
33
|
+
})(VenueBookingHooks || {});
|
|
34
|
+
var DEFAULT_SLOT_CONFIG = {
|
|
35
|
+
slotDurationMinutes: 30,
|
|
36
|
+
businessStartTime: "09:00",
|
|
37
|
+
businessEndTime: "23:00",
|
|
38
|
+
fewLeftThreshold: 0.8
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
DEFAULT_SLOT_CONFIG,
|
|
43
|
+
VenueBookingHooks
|
|
44
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { VenueBookingSlotConfig, VenueResourceRawData, VenueDateSummaryItem, ResourceProductMapping } from '../types';
|
|
2
|
+
import type { QuotationModule } from '../../../modules/Quotation';
|
|
3
|
+
export declare function buildDateRangeSummary(params: {
|
|
4
|
+
startDate: string;
|
|
5
|
+
endDate: string;
|
|
6
|
+
config: VenueBookingSlotConfig;
|
|
7
|
+
rawResources: VenueResourceRawData[];
|
|
8
|
+
resourceProductMap: Map<number | string, ResourceProductMapping>;
|
|
9
|
+
quotationModule?: QuotationModule;
|
|
10
|
+
}): VenueDateSummaryItem[];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/solution/VenueBooking/utils/dateSummary.ts
|
|
30
|
+
var dateSummary_exports = {};
|
|
31
|
+
__export(dateSummary_exports, {
|
|
32
|
+
buildDateRangeSummary: () => buildDateRangeSummary
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(dateSummary_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_timeSlot = require("./timeSlot");
|
|
37
|
+
function buildDateRangeSummary(params) {
|
|
38
|
+
const { startDate, endDate, config, rawResources, resourceProductMap, quotationModule } = params;
|
|
39
|
+
const result = [];
|
|
40
|
+
const productIds = quotationModule ? [...new Set([...resourceProductMap.values()].map((m) => m.productId))] : [];
|
|
41
|
+
let cursor = (0, import_dayjs.default)(startDate);
|
|
42
|
+
const end = (0, import_dayjs.default)(endDate);
|
|
43
|
+
while (!cursor.isAfter(end)) {
|
|
44
|
+
const date = cursor.format("YYYY-MM-DD");
|
|
45
|
+
let quotationPriceMap;
|
|
46
|
+
if (quotationModule && productIds.length) {
|
|
47
|
+
const timeLabels = (0, import_timeSlot.generateTimeLabels)(config);
|
|
48
|
+
const timePoints = timeLabels.map((label) => `${date} ${label}`);
|
|
49
|
+
quotationPriceMap = quotationModule.buildProductPriceMap({ productIds, timePoints });
|
|
50
|
+
}
|
|
51
|
+
const grid = (0, import_timeSlot.buildTimeSlotGrid)({
|
|
52
|
+
date,
|
|
53
|
+
config,
|
|
54
|
+
rawResources,
|
|
55
|
+
resourceProductMap,
|
|
56
|
+
quotationPriceMap
|
|
57
|
+
});
|
|
58
|
+
let totalSlots = 0;
|
|
59
|
+
let availableSlots = 0;
|
|
60
|
+
let lowestPrice = null;
|
|
61
|
+
for (const resource of grid.resources) {
|
|
62
|
+
for (const slot of resource.slots) {
|
|
63
|
+
if (slot.status === "past" || slot.status === "unavailable")
|
|
64
|
+
continue;
|
|
65
|
+
totalSlots++;
|
|
66
|
+
if (slot.status === "available" || slot.status === "partially_occupied") {
|
|
67
|
+
availableSlots++;
|
|
68
|
+
if (slot.price !== null) {
|
|
69
|
+
const priceNum = Number(slot.price);
|
|
70
|
+
if (Number.isFinite(priceNum) && (lowestPrice === null || priceNum < lowestPrice)) {
|
|
71
|
+
lowestPrice = priceNum;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let status;
|
|
78
|
+
if (totalSlots === 0) {
|
|
79
|
+
status = "unavailable";
|
|
80
|
+
} else if (availableSlots === 0) {
|
|
81
|
+
status = "sold_out";
|
|
82
|
+
} else if ((totalSlots - availableSlots) / totalSlots >= config.fewLeftThreshold) {
|
|
83
|
+
status = "few_left";
|
|
84
|
+
} else {
|
|
85
|
+
status = "available";
|
|
86
|
+
}
|
|
87
|
+
result.push({
|
|
88
|
+
date,
|
|
89
|
+
status,
|
|
90
|
+
startingPrice: lowestPrice !== null ? lowestPrice.toFixed(2) : null,
|
|
91
|
+
totalSlots,
|
|
92
|
+
availableSlots
|
|
93
|
+
});
|
|
94
|
+
cursor = cursor.add(1, "day");
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
buildDateRangeSummary
|
|
101
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProductData } from '../../../modules/Product/types';
|
|
2
|
+
import type { ResourceProductMapping } from '../types';
|
|
3
|
+
export declare function extractResourceIds(products: ProductData[]): number[];
|
|
4
|
+
export declare function buildResourceProductMap(products: ProductData[]): Map<number | string, ResourceProductMapping>;
|