@pisell/pisellos 0.0.510 → 0.0.512
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/modules/Order/index.d.ts +3 -6
- package/dist/modules/Order/index.js +129 -62
- package/dist/modules/Order/types.d.ts +23 -5
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +64 -11
- package/dist/modules/Order/utils.js +269 -43
- package/dist/modules/SalesSummary/utils.js +33 -68
- package/dist/modules/Summary/utils.js +6 -21
- package/dist/solution/ScanOrder/index.d.ts +10 -5
- package/dist/solution/ScanOrder/index.js +605 -492
- package/dist/solution/ScanOrder/types.d.ts +43 -2
- package/dist/solution/ScanOrder/types.js +13 -0
- package/dist/solution/ScanOrder/utils.d.ts +26 -12
- package/dist/solution/ScanOrder/utils.js +130 -82
- package/dist/solution/VenueBooking/index.d.ts +2 -5
- package/dist/solution/VenueBooking/index.js +35 -27
- package/lib/modules/Order/index.d.ts +3 -6
- package/lib/modules/Order/index.js +98 -24
- package/lib/modules/Order/types.d.ts +23 -5
- package/lib/modules/Order/utils.d.ts +64 -11
- package/lib/modules/Order/utils.js +167 -15
- package/lib/modules/SalesSummary/utils.js +13 -47
- package/lib/modules/Summary/utils.js +4 -18
- package/lib/solution/ScanOrder/index.d.ts +10 -5
- package/lib/solution/ScanOrder/index.js +60 -4
- package/lib/solution/ScanOrder/types.d.ts +43 -2
- package/lib/solution/ScanOrder/utils.d.ts +26 -12
- package/lib/solution/ScanOrder/utils.js +76 -68
- package/lib/solution/VenueBooking/index.d.ts +2 -5
- package/lib/solution/VenueBooking/index.js +13 -6
- package/package.json +1 -1
|
@@ -39,21 +39,62 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
|
39
39
|
order_detail_id: number | null;
|
|
40
40
|
num: number;
|
|
41
41
|
product_option_item: any[];
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* 券后 **行 composite 单价** = `metadata.main_product_selling_price`
|
|
44
|
+
* + Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? 1))
|
|
45
|
+
*
|
|
46
|
+
* 新语义 v2 下 `metadata.main_product_selling_price` 已经**含 option**、含主商品折扣,
|
|
47
|
+
* 因此本字段不再叠加 option。未应用券时等同 `original_price`。
|
|
48
|
+
* Rules 钩子、主商品计税、Summary 统一读 metadata,不以此字段反推。
|
|
49
|
+
*/
|
|
43
50
|
selling_price: string;
|
|
44
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* 券前 **行 composite 单价** = `metadata.main_product_original_price`
|
|
53
|
+
* + Σ(bundle 原价 × num)
|
|
54
|
+
*
|
|
55
|
+
* 新语义 v2 下 `metadata.main_product_original_price` 已经**含 option**、不含折扣。
|
|
56
|
+
* 不承载后台划线价语义。
|
|
57
|
+
*/
|
|
45
58
|
original_price: string;
|
|
46
59
|
tax_fee: string;
|
|
47
60
|
is_charge_tax: number;
|
|
48
61
|
discount_list: any[];
|
|
49
62
|
product_bundle: any[];
|
|
63
|
+
/**
|
|
64
|
+
* 行级扩展 metadata。价格相关的权威字段:
|
|
65
|
+
*
|
|
66
|
+
* - `source_product_price`:主商品/variant 基础价(已应用报价单),**不含 option、不含折扣**。
|
|
67
|
+
* 是派生 `main_product_*` 的唯一源。variant 分支优先读 `metadata.origin.variant[vid].price`。
|
|
68
|
+
* - `main_product_original_price` = `source_product_price + Σ(option.price × option.num)`,
|
|
69
|
+
* **含 option、不含折扣**。
|
|
70
|
+
* - `main_product_selling_price` = `main_product_original_price − 主商品券 per-unit amount`,
|
|
71
|
+
* **含 option、含主商品折扣**。Rules 钩子 / Summary / 计税均以此为主商品权威源。
|
|
72
|
+
* - `price_schema_version`(当前 = 2):schema 版本 sentinel,用于跨端协商价格口径、
|
|
73
|
+
* 区分 v1 旧缓存以便 `normalizeOrderProduct` 触发迁移。
|
|
74
|
+
*/
|
|
50
75
|
metadata: Record<string, any>;
|
|
76
|
+
/** 商品行备注(如顾客对单品的特殊要求) */
|
|
77
|
+
note?: string;
|
|
51
78
|
_origin?: Record<string, any>;
|
|
52
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* 出站 payload 版本的商品行。
|
|
82
|
+
*
|
|
83
|
+
* 与 tempOrder 内部 `ScanOrderOrderProduct` 的字段差异:
|
|
84
|
+
* - `product_option_item[*]`:内部为 `{ product_option_item_id, option_group_id, num, price, ... }`,
|
|
85
|
+
* 出站由 `normalizeSubmitProduct` 重命名为 `{ option_group_item_id, option_group_id, num }`
|
|
86
|
+
* (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
|
|
87
|
+
* - `product_bundle[*].option[*]`:同上重命名规则。
|
|
88
|
+
*
|
|
89
|
+
* 运行时(UI 显示、加购合并、指纹、持久化)全部消费内部字段名 `product_option_item_id`,
|
|
90
|
+
* 仅在 SDK 提交边界做一次出站映射,不影响 opaque identity 契约。
|
|
91
|
+
*/
|
|
53
92
|
export interface ScanOrderSubmitProduct extends Omit<ScanOrderOrderProduct, '_origin' | 'identity_key'> {
|
|
54
93
|
/**
|
|
55
94
|
* 出站兼容字段:SDK 内部不再消费 payment_price,
|
|
56
95
|
* 仅在提交后端时由 selling_price 派生,保持原有后端契约。
|
|
96
|
+
* 新语义 v2 下 selling_price 是 composite(含 option、含 bundle、含主商品折扣),
|
|
97
|
+
* 因此 payment_price 同样是 composite。
|
|
57
98
|
*/
|
|
58
99
|
payment_price: string;
|
|
59
100
|
}
|
|
@@ -10,6 +10,19 @@ export var ScanOrderHooks = /*#__PURE__*/function (ScanOrderHooks) {
|
|
|
10
10
|
return ScanOrderHooks;
|
|
11
11
|
}({});
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* 出站 payload 版本的商品行。
|
|
15
|
+
*
|
|
16
|
+
* 与 tempOrder 内部 `ScanOrderOrderProduct` 的字段差异:
|
|
17
|
+
* - `product_option_item[*]`:内部为 `{ product_option_item_id, option_group_id, num, price, ... }`,
|
|
18
|
+
* 出站由 `normalizeSubmitProduct` 重命名为 `{ option_group_item_id, option_group_id, num }`
|
|
19
|
+
* (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
|
|
20
|
+
* - `product_bundle[*].option[*]`:同上重命名规则。
|
|
21
|
+
*
|
|
22
|
+
* 运行时(UI 显示、加购合并、指纹、持久化)全部消费内部字段名 `product_option_item_id`,
|
|
23
|
+
* 仅在 SDK 提交边界做一次出站映射,不影响 opaque identity 契约。
|
|
24
|
+
*/
|
|
25
|
+
|
|
13
26
|
/**
|
|
14
27
|
* ScanOrder 临时订单(runtime-clean 版本)
|
|
15
28
|
* 只保留运行时字段,不包含任何 __comment 字段
|
|
@@ -92,16 +92,14 @@ export declare function buildProductLineFingerprint(productOptionItem?: unknown,
|
|
|
92
92
|
*/
|
|
93
93
|
export declare function isSkuOnlyDeleteIdentity(x: ScanOrderOrderProductIdentity): boolean;
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* - 否则若任一方为「仅 SKU」删除通配(未声明 product_option_item / product_bundle 键),只比 SKU。
|
|
104
|
-
* - 否则比较选项 + 套餐指纹(同 SKU 且指纹相同才合并数量)。
|
|
95
|
+
* 判断两个商品 identity 是否匹配(不透明 identity 契约)。
|
|
96
|
+
*
|
|
97
|
+
* 调用约定:始终 `isIdentityMatch(line, callerIdentity)`。
|
|
98
|
+
* - 若 SKU(product_id + product_variant_id)不一致 → 不匹配。
|
|
99
|
+
* - **双方都带** `identity_key` → 严格字符串相等比较(不再猜测合成 key / metadata 桥接)。
|
|
100
|
+
* 这是 opaque identity 契约的标准路径:UI 删改时透传 SDK 回灌的 identity_key。
|
|
101
|
+
* - 否则(即至少一侧未声明 identity_key)→ 进入「SKU 通配 / 显式空选项 / 指纹」回退路径,
|
|
102
|
+
* 忽略线侧 identity_key,按内容语义匹配。这给「行已 opaque、调用方却想按 SKU 通配 / 选项指纹删除」留兼容入口。
|
|
105
103
|
*/
|
|
106
104
|
export declare function isIdentityMatch(a: ScanOrderOrderProductIdentity, b: ScanOrderOrderProductIdentity): boolean;
|
|
107
105
|
/**
|
|
@@ -110,10 +108,26 @@ export declare function isIdentityMatch(a: ScanOrderOrderProductIdentity, b: Sca
|
|
|
110
108
|
*/
|
|
111
109
|
export declare function getProductIdentityIndex(products: ScanOrderOrderProduct[], identity: ScanOrderOrderProductIdentity): number;
|
|
112
110
|
/**
|
|
113
|
-
*
|
|
111
|
+
* 对外部传入的商品对象做归一化(v2 composite 语义):
|
|
114
112
|
* - 补全可选字段默认值(未传则使用兜底值,避免后续计算时因 undefined 导致异常)
|
|
115
113
|
* - 对 num 调用 getSafeProductNum 做安全处理
|
|
116
114
|
* - 保留 _origin 供后续业务流程(如促销规则)使用
|
|
115
|
+
*
|
|
116
|
+
* 价格字段语义(metadata 权威源 + composite 派生):
|
|
117
|
+
* - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),**不含 option**、
|
|
118
|
+
* **不含折扣**。是推导 main_product_* 的起点。variant 分支优先读 `metadata.origin.variant[vid].price`。
|
|
119
|
+
* - `metadata.main_product_original_price`:`source + Σ(option.price × option.num)`,**含 option**、
|
|
120
|
+
* **不含折扣**。
|
|
121
|
+
* - `metadata.main_product_selling_price`:`main_product_original_price - 主商品券 per-unit amount`,
|
|
122
|
+
* **含 option**、**含折扣**。
|
|
123
|
+
* - 行级 `selling_price` = `main_product_selling_price + Σ(bundle_selling_price × num)`。
|
|
124
|
+
* - 行级 `original_price` = `main_product_original_price + Σ(bundle 原价 × num)`。
|
|
125
|
+
*
|
|
126
|
+
* 迁移与幂等:
|
|
127
|
+
* - `metadata.price_schema_version === 2` → 已新语义归一化,保留 main_product_* 原值(保留折扣)。
|
|
128
|
+
* - 其它情况(v1 / 缺字段 / 无 metadata)→ 按"main_product_selling_price 曾是 main-only"的旧约定
|
|
129
|
+
* 反推 legacyDiscount,再以新 source + options 基准重算。最终统一打上 `price_schema_version: 2`。
|
|
130
|
+
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
117
131
|
*/
|
|
118
132
|
export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): ScanOrderOrderProduct;
|
|
119
133
|
/**
|
|
@@ -129,7 +143,7 @@ export declare function hasCustomCapacityProduct(products: ProductData[]): boole
|
|
|
129
143
|
/**
|
|
130
144
|
* 根据预约规则商品的 resource.type 计算桌台是否已被"占满"。
|
|
131
145
|
* - single:只要有 `lastOrderId` 即视为占用
|
|
132
|
-
* - multiple:当前时间落在 `capacity_list[i]` 的 `[start_at, end_at]`(inclusive)内的 pax 之和
|
|
146
|
+
* - multiple:当前时间落在 `capacity_list[i]` 的 `[start_at, end_at]`(inclusive)内的 pax 之和 >= 总容量
|
|
133
147
|
* - 其他('capacity' / undefined):返回 false,不施加限制
|
|
134
148
|
*/
|
|
135
149
|
export declare function computeResourceIsFull(params: {
|
|
@@ -12,6 +12,9 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
12
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
|
+
import Decimal from 'decimal.js';
|
|
16
|
+
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
17
|
+
|
|
15
18
|
/**
|
|
16
19
|
* 构建金额全为 0 的空 summary。
|
|
17
20
|
* 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
|
|
@@ -412,43 +415,6 @@ export function isSkuOnlyDeleteIdentity(x) {
|
|
|
412
415
|
if (x.identity_key) return false;
|
|
413
416
|
return !('product_option_item' in x) && !('product_bundle' in x);
|
|
414
417
|
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* 与常见 UI 约定一致:仅当存在**一条** `product_option_item` 时,
|
|
418
|
-
* `${product_id}_${option_group_id}_${product_option_item_id}_${num}` 可作为删除用 `identity_key`。
|
|
419
|
-
* 多小料行请使用加购时的 `identity_key` / `metadata.unique_identification_number` 或按 `product_option_item` 指纹删除。
|
|
420
|
-
*/
|
|
421
|
-
export function buildSyntheticSingleOptionIdentityKey(productId, productOptionItem) {
|
|
422
|
-
if (productId == null || !Number.isFinite(Number(productId))) return undefined;
|
|
423
|
-
var opts = Array.isArray(productOptionItem) ? productOptionItem : [];
|
|
424
|
-
if (opts.length !== 1) return undefined;
|
|
425
|
-
var o = opts[0];
|
|
426
|
-
var gid = Number(o === null || o === void 0 ? void 0 : o.option_group_id) || 0;
|
|
427
|
-
var oid = Number(o === null || o === void 0 ? void 0 : o.product_option_item_id) || 0;
|
|
428
|
-
var rawNum = o === null || o === void 0 ? void 0 : o.num;
|
|
429
|
-
var n = typeof rawNum === 'number' && !Number.isNaN(rawNum) ? Math.max(1, Math.floor(rawNum)) : 1;
|
|
430
|
-
return "".concat(productId, "_").concat(gid, "_").concat(oid, "_").concat(n);
|
|
431
|
-
}
|
|
432
|
-
function collectLineIdentityKeyCandidates(x) {
|
|
433
|
-
var _row$metadata;
|
|
434
|
-
var out = new Set();
|
|
435
|
-
var row = x;
|
|
436
|
-
if (typeof row.identity_key === 'string' && row.identity_key.length > 0) {
|
|
437
|
-
out.add(row.identity_key);
|
|
438
|
-
}
|
|
439
|
-
var uid = (_row$metadata = row.metadata) === null || _row$metadata === void 0 ? void 0 : _row$metadata.unique_identification_number;
|
|
440
|
-
if (typeof uid === 'string' && uid.length > 0) out.add(uid);
|
|
441
|
-
var synthetic = buildSyntheticSingleOptionIdentityKey(row.product_id, row.product_option_item);
|
|
442
|
-
if (synthetic) out.add(synthetic);
|
|
443
|
-
var opts = 'product_option_item' in row && Array.isArray(row.product_option_item) ? row.product_option_item : [];
|
|
444
|
-
var bundles = 'product_bundle' in row && Array.isArray(row.product_bundle) ? row.product_bundle : [];
|
|
445
|
-
// 无小料且无套餐时,与常见 UI 约定对齐:`${product_id}_${product_variant_id}_0`
|
|
446
|
-
if (opts.length === 0 && bundles.length === 0 && row.product_id != null && Number.isFinite(Number(row.product_id))) {
|
|
447
|
-
var vid = Number(row.product_variant_id) || 0;
|
|
448
|
-
out.add("".concat(row.product_id, "_").concat(vid, "_0"));
|
|
449
|
-
}
|
|
450
|
-
return out;
|
|
451
|
-
}
|
|
452
418
|
function fingerprintForIdentityWithOptionKeys(x) {
|
|
453
419
|
var row = x;
|
|
454
420
|
var opts = 'product_option_item' in row ? Array.isArray(row.product_option_item) ? row.product_option_item : [] : [];
|
|
@@ -457,23 +423,20 @@ function fingerprintForIdentityWithOptionKeys(x) {
|
|
|
457
423
|
}
|
|
458
424
|
|
|
459
425
|
/**
|
|
460
|
-
* 判断两个商品 identity
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
* -
|
|
426
|
+
* 判断两个商品 identity 是否匹配(不透明 identity 契约)。
|
|
427
|
+
*
|
|
428
|
+
* 调用约定:始终 `isIdentityMatch(line, callerIdentity)`。
|
|
429
|
+
* - 若 SKU(product_id + product_variant_id)不一致 → 不匹配。
|
|
430
|
+
* - **双方都带** `identity_key` → 严格字符串相等比较(不再猜测合成 key / metadata 桥接)。
|
|
431
|
+
* 这是 opaque identity 契约的标准路径:UI 删改时透传 SDK 回灌的 identity_key。
|
|
432
|
+
* - 否则(即至少一侧未声明 identity_key)→ 进入「SKU 通配 / 显式空选项 / 指纹」回退路径,
|
|
433
|
+
* 忽略线侧 identity_key,按内容语义匹配。这给「行已 opaque、调用方却想按 SKU 通配 / 选项指纹删除」留兼容入口。
|
|
464
434
|
*/
|
|
465
435
|
export function isIdentityMatch(a, b) {
|
|
466
436
|
if (a.product_id !== b.product_id || a.product_variant_id !== b.product_variant_id) return false;
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
return collectLineIdentityKeyCandidates(b).has(a.identity_key);
|
|
471
|
-
}
|
|
472
|
-
if (!a.identity_key && b.identity_key) {
|
|
473
|
-
return collectLineIdentityKeyCandidates(a).has(b.identity_key);
|
|
474
|
-
}
|
|
475
|
-
return false;
|
|
476
|
-
}
|
|
437
|
+
var aHasKey = typeof a.identity_key === 'string' && a.identity_key.length > 0;
|
|
438
|
+
var bHasKey = typeof b.identity_key === 'string' && b.identity_key.length > 0;
|
|
439
|
+
if (aHasKey && bHasKey) return a.identity_key === b.identity_key;
|
|
477
440
|
if (isSkuOnlyDeleteIdentity(a) || isSkuOnlyDeleteIdentity(b)) return true;
|
|
478
441
|
return fingerprintForIdentityWithOptionKeys(a) === fingerprintForIdentityWithOptionKeys(b);
|
|
479
442
|
}
|
|
@@ -489,56 +452,141 @@ export function getProductIdentityIndex(products, identity) {
|
|
|
489
452
|
}
|
|
490
453
|
|
|
491
454
|
/**
|
|
492
|
-
*
|
|
455
|
+
* 对外部传入的商品对象做归一化(v2 composite 语义):
|
|
493
456
|
* - 补全可选字段默认值(未传则使用兜底值,避免后续计算时因 undefined 导致异常)
|
|
494
457
|
* - 对 num 调用 getSafeProductNum 做安全处理
|
|
495
458
|
* - 保留 _origin 供后续业务流程(如促销规则)使用
|
|
459
|
+
*
|
|
460
|
+
* 价格字段语义(metadata 权威源 + composite 派生):
|
|
461
|
+
* - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),**不含 option**、
|
|
462
|
+
* **不含折扣**。是推导 main_product_* 的起点。variant 分支优先读 `metadata.origin.variant[vid].price`。
|
|
463
|
+
* - `metadata.main_product_original_price`:`source + Σ(option.price × option.num)`,**含 option**、
|
|
464
|
+
* **不含折扣**。
|
|
465
|
+
* - `metadata.main_product_selling_price`:`main_product_original_price - 主商品券 per-unit amount`,
|
|
466
|
+
* **含 option**、**含折扣**。
|
|
467
|
+
* - 行级 `selling_price` = `main_product_selling_price + Σ(bundle_selling_price × num)`。
|
|
468
|
+
* - 行级 `original_price` = `main_product_original_price + Σ(bundle 原价 × num)`。
|
|
469
|
+
*
|
|
470
|
+
* 迁移与幂等:
|
|
471
|
+
* - `metadata.price_schema_version === 2` → 已新语义归一化,保留 main_product_* 原值(保留折扣)。
|
|
472
|
+
* - 其它情况(v1 / 缺字段 / 无 metadata)→ 按"main_product_selling_price 曾是 main-only"的旧约定
|
|
473
|
+
* 反推 legacyDiscount,再以新 source + options 基准重算。最终统一打上 `price_schema_version: 2`。
|
|
474
|
+
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
496
475
|
*/
|
|
497
476
|
export function normalizeOrderProduct(product) {
|
|
498
|
-
var _product$is_charge_ta;
|
|
477
|
+
var _metadata$origin, _variantList$find, _product$is_charge_ta;
|
|
499
478
|
var metadata = _objectSpread({}, product.metadata || {});
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
// 初次加购时两者相等(入口层应保证 caller 传的 original_price == selling_price);
|
|
506
|
-
// 券应用后由 Rules 引擎只改动 selling_price,保留 original_price 以便还原 / 展示划线对比。
|
|
507
|
-
// 注意:这里 caller 若显式传入了 original_price(例如 Rules 回写或单测场景),要尊重该值,
|
|
508
|
-
// 让券后状态能正确通过再次 normalize。
|
|
509
|
-
var resolvedSellingPrice = product.selling_price || '0.00';
|
|
510
|
-
var resolvedOriginalPrice = product.original_price || resolvedSellingPrice;
|
|
511
|
-
if (metadata.main_product_original_price === undefined) {
|
|
512
|
-
metadata.main_product_original_price = resolvedOriginalPrice;
|
|
513
|
-
}
|
|
514
|
-
if (metadata.main_product_selling_price === undefined) {
|
|
515
|
-
metadata.main_product_selling_price = resolvedSellingPrice;
|
|
516
|
-
}
|
|
517
|
-
if (metadata.source_product_price === undefined) {
|
|
518
|
-
var _ref2, _product$_origin$pric, _product$_origin, _product$_origin2;
|
|
519
|
-
metadata.source_product_price = (_ref2 = (_product$_origin$pric = (_product$_origin = product._origin) === null || _product$_origin === void 0 ? void 0 : _product$_origin.price) !== null && _product$_origin$pric !== void 0 ? _product$_origin$pric : (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.base_price) !== null && _ref2 !== void 0 ? _ref2 : resolvedSellingPrice;
|
|
479
|
+
// 不透明 identity 契约:每条订单行必须带 identity_key。
|
|
480
|
+
// 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
|
|
481
|
+
var resolvedIdentityKey = product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
482
|
+
if (!metadata.unique_identification_number) {
|
|
483
|
+
metadata.unique_identification_number = resolvedIdentityKey;
|
|
520
484
|
}
|
|
521
485
|
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
522
|
-
var
|
|
486
|
+
var _ref2, _item$bundle_selling_, _ref3, _ref4, _item$custom_price;
|
|
523
487
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
524
|
-
bundle_selling_price: (
|
|
525
|
-
custom_price: (
|
|
488
|
+
bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00',
|
|
489
|
+
custom_price: (_ref3 = (_ref4 = (_item$custom_price = item.custom_price) !== null && _item$custom_price !== void 0 ? _item$custom_price : item.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : item.price) !== null && _ref3 !== void 0 ? _ref3 : '0.00'
|
|
526
490
|
});
|
|
527
491
|
});
|
|
492
|
+
var normalizedOptions = product.product_option_item || [];
|
|
493
|
+
var optionSum = sumOptionUnitPrice(normalizedOptions);
|
|
494
|
+
|
|
495
|
+
// 1) 解析 source_product_price。
|
|
496
|
+
// 优先级:
|
|
497
|
+
// 1) metadata.source_product_price(v2 权威)
|
|
498
|
+
// 2) variantPrice(命中 variant_id,从 metadata.origin.variant[vid].price 读)
|
|
499
|
+
// 3) _origin.price / _origin.base_price(后端语义的基础价)
|
|
500
|
+
// 4) v1 兼容:无 v2 标记但存在 metadata.main_product_original_price(v1 main-only,即旧 source)
|
|
501
|
+
// 5) 入参 original_price(v1 addProduct 约定:original_price 为 pre-discount 基础价)
|
|
502
|
+
// 6) 入参 selling_price(最末兜底,新添加路径 caller 只给 selling_price)
|
|
503
|
+
var isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === '2';
|
|
504
|
+
var variantId = Number(product.product_variant_id || 0);
|
|
505
|
+
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant : null;
|
|
506
|
+
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
507
|
+
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
508
|
+
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
509
|
+
var resolvedSource = function (_product$_origin, _product$_origin2, _ref5, _product$original_pri) {
|
|
510
|
+
if (metadata.source_product_price !== undefined) {
|
|
511
|
+
return String(metadata.source_product_price);
|
|
512
|
+
}
|
|
513
|
+
if (variantPrice !== undefined && variantPrice !== null) {
|
|
514
|
+
return String(variantPrice);
|
|
515
|
+
}
|
|
516
|
+
var originPrice = (_product$_origin = product._origin) === null || _product$_origin === void 0 ? void 0 : _product$_origin.price;
|
|
517
|
+
if (originPrice !== undefined && originPrice !== null) {
|
|
518
|
+
return String(originPrice);
|
|
519
|
+
}
|
|
520
|
+
var originBasePrice = (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.base_price;
|
|
521
|
+
if (originBasePrice !== undefined && originBasePrice !== null) {
|
|
522
|
+
return String(originBasePrice);
|
|
523
|
+
}
|
|
524
|
+
if (!isV2 && metadata.main_product_original_price !== undefined) {
|
|
525
|
+
return String(metadata.main_product_original_price);
|
|
526
|
+
}
|
|
527
|
+
return (_ref5 = (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product.selling_price) !== null && _ref5 !== void 0 ? _ref5 : '0.00';
|
|
528
|
+
}();
|
|
529
|
+
|
|
530
|
+
// 2) 派生 main_product_original_price(含 option、不含折扣)
|
|
531
|
+
var mainOriginalDec = new Decimal(Number(resolvedSource) || 0).plus(optionSum);
|
|
532
|
+
var mainOriginalStr = mainOriginalDec.toDecimalPlaces(2).toFixed(2);
|
|
533
|
+
|
|
534
|
+
// 3) 派生 main_product_selling_price(含 option、含主商品折扣)
|
|
535
|
+
// - v2 数据:直接沿用 metadata.main_product_selling_price(保留折扣)
|
|
536
|
+
// - v1 metadata:main_product_selling_price 旧语义是 main-only(≈ source-level 折后价),
|
|
537
|
+
// 反推 legacyDiscount = main_original(旧) - main_selling(旧),再用新 main_original - legacyDiscount
|
|
538
|
+
// - v1 addProduct 入参:top-level selling_price < original_price 表示主商品折扣;
|
|
539
|
+
// 用差额作为 legacyDiscount 映射到新 main_selling
|
|
540
|
+
// - 其它:视为无折扣,main_selling = main_original
|
|
541
|
+
var mainSellingDec;
|
|
542
|
+
if (isV2 && metadata.main_product_selling_price != null) {
|
|
543
|
+
mainSellingDec = new Decimal(Number(metadata.main_product_selling_price) || 0);
|
|
544
|
+
} else if (metadata.main_product_selling_price != null && metadata.main_product_original_price != null) {
|
|
545
|
+
var legacyOriginal = new Decimal(Number(metadata.main_product_original_price) || 0);
|
|
546
|
+
var legacySelling = new Decimal(Number(metadata.main_product_selling_price) || 0);
|
|
547
|
+
var legacyDiscount = legacyOriginal.minus(legacySelling);
|
|
548
|
+
mainSellingDec = mainOriginalDec.minus(legacyDiscount);
|
|
549
|
+
} else if (product.original_price != null && product.selling_price != null && new Decimal(Number(product.original_price) || 0).greaterThan(new Decimal(Number(product.selling_price) || 0))) {
|
|
550
|
+
var topOriginal = new Decimal(Number(product.original_price) || 0);
|
|
551
|
+
var topSelling = new Decimal(Number(product.selling_price) || 0);
|
|
552
|
+
var _legacyDiscount = topOriginal.minus(topSelling);
|
|
553
|
+
mainSellingDec = mainOriginalDec.minus(_legacyDiscount);
|
|
554
|
+
} else {
|
|
555
|
+
mainSellingDec = mainOriginalDec;
|
|
556
|
+
}
|
|
557
|
+
var mainSellingStr = mainSellingDec.toDecimalPlaces(2).toFixed(2);
|
|
558
|
+
|
|
559
|
+
// 4) 落盘 metadata:三字段 + schema 版本 sentinel
|
|
560
|
+
metadata.source_product_price = resolvedSource;
|
|
561
|
+
metadata.main_product_original_price = mainOriginalStr;
|
|
562
|
+
metadata.main_product_selling_price = mainSellingStr;
|
|
563
|
+
metadata.price_schema_version = 2;
|
|
564
|
+
|
|
565
|
+
// 5) 合成行级 composite(main 已含 option,本步只叠 bundle)
|
|
566
|
+
var composedSellingPrice = composeLinePrice({
|
|
567
|
+
mainPrice: mainSellingStr,
|
|
568
|
+
bundle: normalizedBundle
|
|
569
|
+
});
|
|
570
|
+
var composedOriginalPrice = composeLinePrice({
|
|
571
|
+
mainPrice: mainOriginalStr,
|
|
572
|
+
bundle: normalizedBundle,
|
|
573
|
+
useOriginalBundle: true
|
|
574
|
+
});
|
|
528
575
|
return {
|
|
529
576
|
order_detail_id: product.order_detail_id || null,
|
|
530
577
|
product_id: product.product_id,
|
|
531
578
|
num: getSafeProductNum(product.num),
|
|
532
579
|
product_variant_id: product.product_variant_id,
|
|
533
|
-
identity_key:
|
|
534
|
-
product_option_item:
|
|
535
|
-
selling_price:
|
|
536
|
-
original_price:
|
|
580
|
+
identity_key: resolvedIdentityKey,
|
|
581
|
+
product_option_item: normalizedOptions,
|
|
582
|
+
selling_price: composedSellingPrice,
|
|
583
|
+
original_price: composedOriginalPrice,
|
|
537
584
|
tax_fee: product.tax_fee || '0.00',
|
|
538
585
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
539
586
|
discount_list: product.discount_list || [],
|
|
540
587
|
product_bundle: normalizedBundle,
|
|
541
588
|
metadata: metadata,
|
|
589
|
+
note: product.note != null ? String(product.note) : '',
|
|
542
590
|
_origin: product._origin
|
|
543
591
|
};
|
|
544
592
|
}
|
|
@@ -613,7 +661,7 @@ export function hasCustomCapacityProduct(products) {
|
|
|
613
661
|
/**
|
|
614
662
|
* 根据预约规则商品的 resource.type 计算桌台是否已被"占满"。
|
|
615
663
|
* - single:只要有 `lastOrderId` 即视为占用
|
|
616
|
-
* - multiple:当前时间落在 `capacity_list[i]` 的 `[start_at, end_at]`(inclusive)内的 pax 之和
|
|
664
|
+
* - multiple:当前时间落在 `capacity_list[i]` 的 `[start_at, end_at]`(inclusive)内的 pax 之和 >= 总容量
|
|
617
665
|
* - 其他('capacity' / undefined):返回 false,不施加限制
|
|
618
666
|
*/
|
|
619
667
|
export function computeResourceIsFull(params) {
|
|
@@ -645,7 +693,7 @@ export function computeResourceIsFull(params) {
|
|
|
645
693
|
} finally {
|
|
646
694
|
_iterator8.f();
|
|
647
695
|
}
|
|
648
|
-
return occupied
|
|
696
|
+
return occupied >= totalCapacity;
|
|
649
697
|
}
|
|
650
698
|
|
|
651
699
|
/**
|
|
@@ -2,6 +2,7 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { VenueBookingAddLogParams, VenueBookingSlotConfig, VenueDateSummaryItem, VenueSlotSelection, VenueTimeSlotGrid } from './types';
|
|
4
4
|
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity } from '../ScanOrder/types';
|
|
5
|
+
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
5
6
|
import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
|
|
6
7
|
import type { ProductData } from '../../modules/Product/types';
|
|
7
8
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
@@ -165,11 +166,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
165
166
|
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
166
167
|
submitOrder<T = any>(): Promise<T>;
|
|
167
168
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
168
|
-
updateProductInOrder(params:
|
|
169
|
-
product_id: number | null;
|
|
170
|
-
product_variant_id: number;
|
|
171
|
-
updates: Partial<ScanOrderOrderProduct>;
|
|
172
|
-
}): Promise<ScanOrderOrderProduct[]>;
|
|
169
|
+
updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
|
|
173
170
|
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
174
171
|
getProductList(): Promise<ProductData[]>;
|
|
175
172
|
private loadOpenDataConfig;
|
|
@@ -45,7 +45,7 @@ import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
|
45
45
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
46
46
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
47
47
|
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildPriceBreakdown } from "./utils/slotMerge";
|
|
48
|
-
import { createUuidV4 } from "../../modules/Order/utils";
|
|
48
|
+
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
49
49
|
import { OrderModule } from "../../modules/Order";
|
|
50
50
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
51
51
|
import Decimal from 'decimal.js';
|
|
@@ -2027,7 +2027,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2027
2027
|
key: "setDiscountSelected",
|
|
2028
2028
|
value: (function () {
|
|
2029
2029
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2030
|
-
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator13, _step13, d, selectedResourceIds, _iterator14, _step14, _product$_origin, product, totalPerUnitDiscount,
|
|
2030
|
+
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator13, _step13, d, selectedResourceIds, _iterator14, _step14, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2031
2031
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2032
2032
|
while (1) switch (_context21.prev = _context21.next) {
|
|
2033
2033
|
case 0:
|
|
@@ -2116,7 +2116,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2116
2116
|
_iterator14.s();
|
|
2117
2117
|
case 21:
|
|
2118
2118
|
if ((_step14 = _iterator14.n()).done) {
|
|
2119
|
-
_context21.next =
|
|
2119
|
+
_context21.next = 35;
|
|
2120
2120
|
break;
|
|
2121
2121
|
}
|
|
2122
2122
|
product = _step14.value;
|
|
@@ -2124,7 +2124,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2124
2124
|
_context21.next = 25;
|
|
2125
2125
|
break;
|
|
2126
2126
|
}
|
|
2127
|
-
return _context21.abrupt("continue",
|
|
2127
|
+
return _context21.abrupt("continue", 33);
|
|
2128
2128
|
case 25:
|
|
2129
2129
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2130
2130
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
@@ -2133,45 +2133,53 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2133
2133
|
return rid != null && selectedResourceIds.has(rid);
|
|
2134
2134
|
});
|
|
2135
2135
|
|
|
2136
|
-
// 2. 以
|
|
2136
|
+
// 2. 以 source_product_price 为券作用基准:券作用于 source(不含 option),
|
|
2137
|
+
// 再把 option 加回得到含 option 的 main_product_selling_price,最后合成 composite。
|
|
2137
2138
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2138
2139
|
return sum + (pd.amount || 0);
|
|
2139
2140
|
}, 0);
|
|
2140
|
-
|
|
2141
|
-
product.
|
|
2141
|
+
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
2142
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
2143
|
+
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
2144
|
+
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
2142
2145
|
if (product.metadata) {
|
|
2143
|
-
product.metadata.main_product_selling_price =
|
|
2146
|
+
product.metadata.main_product_selling_price = newMainSellingPrice;
|
|
2147
|
+
product.metadata.price_schema_version = 2;
|
|
2144
2148
|
}
|
|
2145
|
-
|
|
2149
|
+
product.selling_price = composeLinePrice({
|
|
2150
|
+
mainPrice: newMainSellingPrice,
|
|
2151
|
+
bundle: product.product_bundle
|
|
2152
|
+
});
|
|
2153
|
+
case 33:
|
|
2146
2154
|
_context21.next = 21;
|
|
2147
2155
|
break;
|
|
2148
|
-
case
|
|
2149
|
-
_context21.next =
|
|
2156
|
+
case 35:
|
|
2157
|
+
_context21.next = 40;
|
|
2150
2158
|
break;
|
|
2151
|
-
case 34:
|
|
2152
|
-
_context21.prev = 34;
|
|
2153
|
-
_context21.t0 = _context21["catch"](19);
|
|
2154
|
-
_iterator14.e(_context21.t0);
|
|
2155
2159
|
case 37:
|
|
2156
2160
|
_context21.prev = 37;
|
|
2157
|
-
|
|
2158
|
-
|
|
2161
|
+
_context21.t0 = _context21["catch"](19);
|
|
2162
|
+
_iterator14.e(_context21.t0);
|
|
2159
2163
|
case 40:
|
|
2164
|
+
_context21.prev = 40;
|
|
2165
|
+
_iterator14.f();
|
|
2166
|
+
return _context21.finish(40);
|
|
2167
|
+
case 43:
|
|
2160
2168
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2161
|
-
_context21.next =
|
|
2169
|
+
_context21.next = 46;
|
|
2162
2170
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2163
|
-
case
|
|
2171
|
+
case 46:
|
|
2164
2172
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
2165
2173
|
return d.isSelected;
|
|
2166
2174
|
});
|
|
2167
2175
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2168
2176
|
return d.id === params.discountId;
|
|
2169
2177
|
}) || null;
|
|
2170
|
-
_context21.next =
|
|
2178
|
+
_context21.next = 50;
|
|
2171
2179
|
return this.store.order.recalculateSummary({
|
|
2172
2180
|
createIfMissing: true
|
|
2173
2181
|
});
|
|
2174
|
-
case
|
|
2182
|
+
case 50:
|
|
2175
2183
|
this.store.order.persistTempOrder();
|
|
2176
2184
|
finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
|
|
2177
2185
|
finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
|
|
@@ -2180,16 +2188,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2180
2188
|
return d.id === params.discountId;
|
|
2181
2189
|
}) || null;
|
|
2182
2190
|
return _context21.abrupt("return", this.store.order.getDiscountList());
|
|
2183
|
-
case
|
|
2184
|
-
_context21.prev =
|
|
2191
|
+
case 58:
|
|
2192
|
+
_context21.prev = 58;
|
|
2185
2193
|
_context21.t1 = _context21["catch"](1);
|
|
2186
2194
|
this.logMethodError('setDiscountSelected', _context21.t1);
|
|
2187
2195
|
throw _context21.t1;
|
|
2188
|
-
case
|
|
2196
|
+
case 62:
|
|
2189
2197
|
case "end":
|
|
2190
2198
|
return _context21.stop();
|
|
2191
2199
|
}
|
|
2192
|
-
}, _callee21, this, [[1,
|
|
2200
|
+
}, _callee21, this, [[1, 58], [19, 37, 40, 43]]);
|
|
2193
2201
|
}));
|
|
2194
2202
|
function setDiscountSelected(_x15) {
|
|
2195
2203
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -2336,7 +2344,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2336
2344
|
key: "addProductToOrder",
|
|
2337
2345
|
value: function () {
|
|
2338
2346
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product) {
|
|
2339
|
-
var _product$
|
|
2347
|
+
var _product$metadata5, _product$product_vari2, quotationPrice, products;
|
|
2340
2348
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2341
2349
|
while (1) switch (_context25.prev = _context25.next) {
|
|
2342
2350
|
case 0:
|
|
@@ -2351,7 +2359,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2351
2359
|
}
|
|
2352
2360
|
throw new Error('order 模块未初始化');
|
|
2353
2361
|
case 4:
|
|
2354
|
-
if (!((_product$
|
|
2362
|
+
if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && this.store.quotation && product.product_id != null) {
|
|
2355
2363
|
quotationPrice = this.store.quotation.getPriceForProduct({
|
|
2356
2364
|
productId: product.product_id,
|
|
2357
2365
|
variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams, SubmitScanOrderParams, ScanOrderMoreParams, CheckoutOrderParams } from './types';
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, SubmitScanOrderParams, ScanOrderMoreParams, CheckoutOrderParams, UpdateProductInOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
6
|
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
|
|
@@ -71,11 +71,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
71
71
|
updateTempOrderBuzzer(buzzer: string): string;
|
|
72
72
|
updateTempOrderContactsInfo(contactsInfo: any[]): any[];
|
|
73
73
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
74
|
-
updateProductInOrder(params:
|
|
75
|
-
product_id: number | null;
|
|
76
|
-
product_variant_id: number;
|
|
77
|
-
updates: Partial<ScanOrderOrderProduct>;
|
|
78
|
-
}): Promise<ScanOrderOrderProduct[]>;
|
|
74
|
+
updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
|
|
79
75
|
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
80
76
|
submitTempOrder<T = any>(params?: {
|
|
81
77
|
cacheId?: string;
|
|
@@ -119,3 +115,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
119
115
|
getOrderInfoByRemote(order_id: number): Promise<any>;
|
|
120
116
|
getLastOrderInfo(): Record<string, any> | undefined;
|
|
121
117
|
}
|
|
118
|
+
export type { UpdateProductInOrderParams } from './types';
|