@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,397 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
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
|
+
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
|
+
/**
|
|
15
|
+
* 构建金额全为 0 的空 summary。
|
|
16
|
+
* 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
|
|
17
|
+
*/
|
|
18
|
+
export function createEmptySummary() {
|
|
19
|
+
return {
|
|
20
|
+
product_quantity: 0,
|
|
21
|
+
product_original_amount: '0.00',
|
|
22
|
+
product_amount: '0.00',
|
|
23
|
+
product_expect_amount: '0.00',
|
|
24
|
+
product_tax_fee: '0.00',
|
|
25
|
+
shipping_fee: '0.00',
|
|
26
|
+
shipping_tax_fee: '0.00',
|
|
27
|
+
tax_fee: '0.00',
|
|
28
|
+
surcharge_fee: '0.00',
|
|
29
|
+
discount_amount: '0.00',
|
|
30
|
+
deposit_amount: '0.00',
|
|
31
|
+
expect_amount: '0.00',
|
|
32
|
+
total_amount: '0.00',
|
|
33
|
+
amount_gap: '0.00',
|
|
34
|
+
rounding_amount: '0.00',
|
|
35
|
+
pay_service_charge_amount: '0.00'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 商品数量安全取值。
|
|
41
|
+
* - NaN / undefined / < 1 均视作 1(最低起订量)
|
|
42
|
+
* - 有值时取整(不支持小数数量)
|
|
43
|
+
*/
|
|
44
|
+
export function getSafeProductNum(num) {
|
|
45
|
+
if (!num || Number.isNaN(num)) return 1;
|
|
46
|
+
if (num < 1) return 1;
|
|
47
|
+
return Math.floor(num);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 宽松布尔值转换。
|
|
52
|
+
* 兼容后端/配置中心常见的 boolean / number / string 表达,统一归一成 true/false。
|
|
53
|
+
*/
|
|
54
|
+
export function toBoolean(value) {
|
|
55
|
+
if (typeof value === 'boolean') return value;
|
|
56
|
+
if (typeof value === 'number') return value !== 0;
|
|
57
|
+
if (typeof value === 'string') {
|
|
58
|
+
var normalized = value.trim().toLowerCase();
|
|
59
|
+
return ['1', 'true', 'yes', 'y', 'on'].includes(normalized);
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 将值归一化为有效的正向字符串。
|
|
66
|
+
* null / undefined / 空串 / '0' / 'null' 统一视为无效值并返回 undefined。
|
|
67
|
+
*/
|
|
68
|
+
export function toPositiveString(value) {
|
|
69
|
+
if (value === null || value === undefined || value === '') return undefined;
|
|
70
|
+
var normalized = String(value).trim();
|
|
71
|
+
if (!normalized || normalized === '0' || normalized.toLowerCase() === 'null') {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
return normalized;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 归一化 item rule 策略模型 ID 列表。
|
|
79
|
+
* - 支持 string / number 混合输入
|
|
80
|
+
* - 仅保留 > 0 的合法数字
|
|
81
|
+
* - 自动去重
|
|
82
|
+
*/
|
|
83
|
+
export function normalizeEnabledItemRuleIds(rawIds) {
|
|
84
|
+
if (!Array.isArray(rawIds)) return [];
|
|
85
|
+
var uniqueIds = new Set();
|
|
86
|
+
var _iterator = _createForOfIteratorHelper(rawIds),
|
|
87
|
+
_step;
|
|
88
|
+
try {
|
|
89
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
90
|
+
var item = _step.value;
|
|
91
|
+
var strategyId = Number(item);
|
|
92
|
+
if (Number.isFinite(strategyId) && strategyId > 0) {
|
|
93
|
+
uniqueIds.add(strategyId);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} catch (err) {
|
|
97
|
+
_iterator.e(err);
|
|
98
|
+
} finally {
|
|
99
|
+
_iterator.f();
|
|
100
|
+
}
|
|
101
|
+
return Array.from(uniqueIds);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 从 tableConfig 中提取合法策略模型 ID 列表。
|
|
106
|
+
*/
|
|
107
|
+
export function extractStrategyModelIdsFromTableConfig(tableConfig) {
|
|
108
|
+
var rawIds = Array.isArray(tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.strategy_model_ids) ? tableConfig.strategy_model_ids : [];
|
|
109
|
+
return rawIds.map(function (id) {
|
|
110
|
+
return Number(id);
|
|
111
|
+
}).filter(function (id) {
|
|
112
|
+
return Number.isFinite(id) && id > 0;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 仅保留 item_rule 类型策略。
|
|
118
|
+
*/
|
|
119
|
+
export function normalizeItemRuleStrategies(configs) {
|
|
120
|
+
if (!Array.isArray(configs)) return [];
|
|
121
|
+
return configs.filter(function (config) {
|
|
122
|
+
var _metadata;
|
|
123
|
+
return Boolean(config && _typeof(config) === 'object' && (config === null || config === void 0 || (_metadata = config.metadata) === null || _metadata === void 0 ? void 0 : _metadata.type) === 'item_rule');
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export function toNonNegativeNumber(value) {
|
|
127
|
+
if (typeof value === 'number') {
|
|
128
|
+
return Number.isFinite(value) && value >= 0 ? value : 0;
|
|
129
|
+
}
|
|
130
|
+
if (typeof value === 'string') {
|
|
131
|
+
var parsed = Number(value);
|
|
132
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : 0;
|
|
133
|
+
}
|
|
134
|
+
return 0;
|
|
135
|
+
}
|
|
136
|
+
export function toNonNegativeInt(value) {
|
|
137
|
+
return Math.floor(toNonNegativeNumber(value));
|
|
138
|
+
}
|
|
139
|
+
export function toPriceString(value) {
|
|
140
|
+
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0.00';
|
|
141
|
+
var parsedValue = Number(value);
|
|
142
|
+
if (Number.isNaN(parsedValue)) return fallback;
|
|
143
|
+
return parsedValue.toFixed(2);
|
|
144
|
+
}
|
|
145
|
+
export function buildProductKey(productId, productVariantId) {
|
|
146
|
+
return "".concat(productId, "_").concat(productVariantId);
|
|
147
|
+
}
|
|
148
|
+
export function getTopLevelProductId(product) {
|
|
149
|
+
var _product$product_id;
|
|
150
|
+
var rawProductId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id;
|
|
151
|
+
var productId = Number(rawProductId);
|
|
152
|
+
if (!Number.isFinite(productId) || productId <= 0) return null;
|
|
153
|
+
return productId;
|
|
154
|
+
}
|
|
155
|
+
export function getTopLevelVariantId(product) {
|
|
156
|
+
var _product$product_vari;
|
|
157
|
+
var rawVariantId = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id;
|
|
158
|
+
if (rawVariantId === undefined || rawVariantId === null || rawVariantId === '') {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
var variantId = Number(rawVariantId);
|
|
162
|
+
if (!Number.isFinite(variantId) || variantId <= 0) return null;
|
|
163
|
+
return variantId;
|
|
164
|
+
}
|
|
165
|
+
export function buildQuantityLimitIndex(limits) {
|
|
166
|
+
var exactLimitMap = new Map();
|
|
167
|
+
var productLimitMap = new Map();
|
|
168
|
+
var _iterator2 = _createForOfIteratorHelper(limits),
|
|
169
|
+
_step2;
|
|
170
|
+
try {
|
|
171
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
172
|
+
var limit = _step2.value;
|
|
173
|
+
var _iterator3 = _createForOfIteratorHelper(limit.targets || []),
|
|
174
|
+
_step3;
|
|
175
|
+
try {
|
|
176
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
177
|
+
var target = _step3.value;
|
|
178
|
+
var productId = Number(target.product_id);
|
|
179
|
+
if (!Number.isFinite(productId) || productId <= 0) continue;
|
|
180
|
+
var variantId = Number(target.product_variant_id);
|
|
181
|
+
var hasVariant = Number.isFinite(variantId) && variantId > 0;
|
|
182
|
+
if (hasVariant) {
|
|
183
|
+
var exactKey = buildProductKey(productId, variantId);
|
|
184
|
+
var _existed = exactLimitMap.get(exactKey) || [];
|
|
185
|
+
exactLimitMap.set(exactKey, [].concat(_toConsumableArray(_existed), [limit]));
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
var existed = productLimitMap.get(productId) || [];
|
|
189
|
+
productLimitMap.set(productId, [].concat(_toConsumableArray(existed), [limit]));
|
|
190
|
+
}
|
|
191
|
+
} catch (err) {
|
|
192
|
+
_iterator3.e(err);
|
|
193
|
+
} finally {
|
|
194
|
+
_iterator3.f();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} catch (err) {
|
|
198
|
+
_iterator2.e(err);
|
|
199
|
+
} finally {
|
|
200
|
+
_iterator2.f();
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
exactLimitMap: exactLimitMap,
|
|
204
|
+
productLimitMap: productLimitMap
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
export function resolveSkuMatchedQuantityLimits(params) {
|
|
208
|
+
var productId = params.productId,
|
|
209
|
+
variantId = params.variantId,
|
|
210
|
+
limitIndex = params.limitIndex;
|
|
211
|
+
var exactMatched = variantId && variantId > 0 ? limitIndex.exactLimitMap.get(buildProductKey(productId, variantId)) || [] : [];
|
|
212
|
+
var productMatched = limitIndex.productLimitMap.get(productId) || [];
|
|
213
|
+
return [].concat(_toConsumableArray(exactMatched), _toConsumableArray(productMatched));
|
|
214
|
+
}
|
|
215
|
+
export function aggregateItemRuleLimit(matchedLimits) {
|
|
216
|
+
if (!matchedLimits.length) return null;
|
|
217
|
+
var min;
|
|
218
|
+
var max;
|
|
219
|
+
var exact;
|
|
220
|
+
var mustInclude = false;
|
|
221
|
+
var _iterator4 = _createForOfIteratorHelper(matchedLimits),
|
|
222
|
+
_step4;
|
|
223
|
+
try {
|
|
224
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
225
|
+
var limit = _step4.value;
|
|
226
|
+
if (typeof limit.requiredMin === 'number' && Number.isFinite(limit.requiredMin)) {
|
|
227
|
+
min = min === undefined ? limit.requiredMin : Math.max(min, limit.requiredMin);
|
|
228
|
+
}
|
|
229
|
+
if (typeof limit.requiredMax === 'number' && Number.isFinite(limit.requiredMax)) {
|
|
230
|
+
max = max === undefined ? limit.requiredMax : Math.min(max, limit.requiredMax);
|
|
231
|
+
}
|
|
232
|
+
if (typeof limit.requiredExact === 'number' && Number.isFinite(limit.requiredExact)) {
|
|
233
|
+
exact = limit.requiredExact;
|
|
234
|
+
}
|
|
235
|
+
mustInclude = mustInclude || Boolean(limit.mustInclude);
|
|
236
|
+
}
|
|
237
|
+
} catch (err) {
|
|
238
|
+
_iterator4.e(err);
|
|
239
|
+
} finally {
|
|
240
|
+
_iterator4.f();
|
|
241
|
+
}
|
|
242
|
+
if (typeof exact === 'number' && Number.isFinite(exact)) {
|
|
243
|
+
min = exact;
|
|
244
|
+
max = exact;
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
min: min,
|
|
248
|
+
max: max,
|
|
249
|
+
exact: exact,
|
|
250
|
+
mustInclude: mustInclude
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
export function buildItemRuleBusinessData(params) {
|
|
254
|
+
var tempOrder = params.tempOrder,
|
|
255
|
+
runtimeConfig = params.runtimeConfig,
|
|
256
|
+
itemRuleConfigs = params.itemRuleConfigs;
|
|
257
|
+
var rawPax = runtimeConfig.pax || {};
|
|
258
|
+
var adultPax = toNonNegativeInt(rawPax.adult);
|
|
259
|
+
var childPax = toNonNegativeInt(rawPax.child);
|
|
260
|
+
var totalPax = toNonNegativeInt(rawPax.total) || adultPax + childPax || 1;
|
|
261
|
+
var cartItems = tempOrder.products.reduce(function (result, product) {
|
|
262
|
+
if (typeof product.product_id !== 'number') return result;
|
|
263
|
+
result.push(_objectSpread({
|
|
264
|
+
product_id: product.product_id,
|
|
265
|
+
quantity: toNonNegativeInt(product.num)
|
|
266
|
+
}, typeof product.product_variant_id === 'number' ? {
|
|
267
|
+
product_variant_id: product.product_variant_id
|
|
268
|
+
} : {}));
|
|
269
|
+
return result;
|
|
270
|
+
}, []);
|
|
271
|
+
var historicalItems = Array.isArray(runtimeConfig.historicalItems) ? runtimeConfig.historicalItems.reduce(function (result, item) {
|
|
272
|
+
if (typeof (item === null || item === void 0 ? void 0 : item.product_id) !== 'number') return result;
|
|
273
|
+
result.push(_objectSpread({
|
|
274
|
+
product_id: item.product_id,
|
|
275
|
+
quantity: toNonNegativeInt(item.quantity)
|
|
276
|
+
}, typeof item.product_variant_id === 'number' ? {
|
|
277
|
+
product_variant_id: item.product_variant_id
|
|
278
|
+
} : {}));
|
|
279
|
+
return result;
|
|
280
|
+
}, []) : [];
|
|
281
|
+
return {
|
|
282
|
+
pax: {
|
|
283
|
+
total: totalPax,
|
|
284
|
+
adult: adultPax,
|
|
285
|
+
child: childPax
|
|
286
|
+
},
|
|
287
|
+
cartItems: cartItems,
|
|
288
|
+
historicalItems: historicalItems,
|
|
289
|
+
serviceType: runtimeConfig.serviceType || 'dine-in',
|
|
290
|
+
submissionIndex: typeof runtimeConfig.submissionIndex === 'number' ? toNonNegativeInt(runtimeConfig.submissionIndex) : tempOrder.order_id ? 1 : 0,
|
|
291
|
+
custom: runtimeConfig.custom || {},
|
|
292
|
+
strategyConfigs: itemRuleConfigs
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
export function attachItemRuleLimitsToTopLevelProducts(productList, limits) {
|
|
296
|
+
if (!Array.isArray(productList)) return productList;
|
|
297
|
+
var limitIndex = buildQuantityLimitIndex(limits || []);
|
|
298
|
+
var _iterator5 = _createForOfIteratorHelper(productList),
|
|
299
|
+
_step5;
|
|
300
|
+
try {
|
|
301
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
302
|
+
var item = _step5.value;
|
|
303
|
+
if (!item || _typeof(item) !== 'object') continue;
|
|
304
|
+
var productItem = item;
|
|
305
|
+
var productId = getTopLevelProductId(productItem);
|
|
306
|
+
if (productId === null) continue;
|
|
307
|
+
var variantId = getTopLevelVariantId(productItem);
|
|
308
|
+
var matchedLimits = limits.length ? resolveSkuMatchedQuantityLimits({
|
|
309
|
+
productId: productId,
|
|
310
|
+
variantId: variantId,
|
|
311
|
+
limitIndex: limitIndex
|
|
312
|
+
}) : [];
|
|
313
|
+
var aggregatedLimit = aggregateItemRuleLimit(matchedLimits);
|
|
314
|
+
if (aggregatedLimit) {
|
|
315
|
+
productItem.item_rule_limit = aggregatedLimit;
|
|
316
|
+
} else if ('item_rule_limit' in productItem) {
|
|
317
|
+
delete productItem.item_rule_limit;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
} catch (err) {
|
|
321
|
+
_iterator5.e(err);
|
|
322
|
+
} finally {
|
|
323
|
+
_iterator5.f();
|
|
324
|
+
}
|
|
325
|
+
return productList;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 判断两个商品 identity 是否匹配。
|
|
330
|
+
* 当双方都没有 identity_key 时回退到 product_id + product_variant_id 比较(向后兼容);
|
|
331
|
+
* 一旦有一方携带 identity_key,则必须严格相等。
|
|
332
|
+
*/
|
|
333
|
+
export function isIdentityMatch(a, b) {
|
|
334
|
+
if (a.product_id !== b.product_id || a.product_variant_id !== b.product_variant_id) return false;
|
|
335
|
+
if (!a.identity_key && !b.identity_key) return true;
|
|
336
|
+
return a.identity_key === b.identity_key;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* 根据 identity 在商品列表中定位下标。
|
|
341
|
+
* 用于判断商品是否已存在(已存在则累加数量,否则新增)。
|
|
342
|
+
*/
|
|
343
|
+
export function getProductIdentityIndex(products, identity) {
|
|
344
|
+
return products.findIndex(function (item) {
|
|
345
|
+
return isIdentityMatch(item, identity);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 对外部传入的商品对象做归一化:
|
|
351
|
+
* - 补全可选字段默认值(未传则使用兜底值,避免后续计算时因 undefined 导致异常)
|
|
352
|
+
* - 对 num 调用 getSafeProductNum 做安全处理
|
|
353
|
+
* - 保留 _origin 供后续业务流程(如促销规则)使用
|
|
354
|
+
*/
|
|
355
|
+
export function normalizeOrderProduct(product) {
|
|
356
|
+
var _product$is_charge_ta;
|
|
357
|
+
var metadata = _objectSpread({}, product.metadata || {});
|
|
358
|
+
if (product.identity_key && !metadata.unique_identification_number) {
|
|
359
|
+
metadata.unique_identification_number = product.identity_key;
|
|
360
|
+
}
|
|
361
|
+
var resolvedOriginalPrice = product.original_price || '0.00';
|
|
362
|
+
var resolvedSellingPrice = product.selling_price || '0.00';
|
|
363
|
+
if (metadata.main_product_original_price === undefined) {
|
|
364
|
+
metadata.main_product_original_price = resolvedOriginalPrice;
|
|
365
|
+
}
|
|
366
|
+
if (metadata.main_product_selling_price === undefined) {
|
|
367
|
+
metadata.main_product_selling_price = resolvedSellingPrice;
|
|
368
|
+
}
|
|
369
|
+
if (metadata.source_product_price === undefined) {
|
|
370
|
+
var _product$_origin$orig, _product$_origin;
|
|
371
|
+
metadata.source_product_price = (_product$_origin$orig = (_product$_origin = product._origin) === null || _product$_origin === void 0 ? void 0 : _product$_origin.original_price) !== null && _product$_origin$orig !== void 0 ? _product$_origin$orig : resolvedOriginalPrice;
|
|
372
|
+
}
|
|
373
|
+
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
374
|
+
var _ref, _item$bundle_selling_, _ref2, _ref3, _item$custom_price;
|
|
375
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
376
|
+
bundle_selling_price: (_ref = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref !== void 0 ? _ref : '0.00',
|
|
377
|
+
custom_price: (_ref2 = (_ref3 = (_item$custom_price = item.custom_price) !== null && _item$custom_price !== void 0 ? _item$custom_price : item.bundle_selling_price) !== null && _ref3 !== void 0 ? _ref3 : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00'
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
return {
|
|
381
|
+
order_detail_id: product.order_detail_id || null,
|
|
382
|
+
product_id: product.product_id,
|
|
383
|
+
num: getSafeProductNum(product.num),
|
|
384
|
+
product_variant_id: product.product_variant_id,
|
|
385
|
+
identity_key: product.identity_key,
|
|
386
|
+
product_option_item: product.product_option_item || [],
|
|
387
|
+
selling_price: resolvedSellingPrice,
|
|
388
|
+
original_price: resolvedOriginalPrice,
|
|
389
|
+
payment_price: product.payment_price || '0.00',
|
|
390
|
+
tax_fee: product.tax_fee || '0.00',
|
|
391
|
+
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
392
|
+
discount_list: product.discount_list || [],
|
|
393
|
+
product_bundle: normalizedBundle,
|
|
394
|
+
metadata: metadata,
|
|
395
|
+
_origin: product._origin
|
|
396
|
+
};
|
|
397
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
+
import { VenueBookingAddLogParams, VenueBookingSlotConfig, VenueDateSummaryItem, VenueSlotSelection, VenueTimeSlotGrid } from './types';
|
|
4
|
+
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity } from '../ScanOrder/types';
|
|
5
|
+
import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
|
|
6
|
+
import type { ProductData } from '../../modules/Product/types';
|
|
7
|
+
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
8
|
+
import type { StrategyConfig } from '../../model/strategy/type';
|
|
9
|
+
export * from './types';
|
|
10
|
+
interface VenueBookingItemRuleRuntimeConfig {
|
|
11
|
+
strategyConfigs?: StrategyConfig[];
|
|
12
|
+
pax?: Partial<PaxInfo>;
|
|
13
|
+
historicalItems?: CartItemSummary[];
|
|
14
|
+
serviceType?: string;
|
|
15
|
+
submissionIndex?: number;
|
|
16
|
+
custom?: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
19
|
+
protected defaultName: string;
|
|
20
|
+
protected defaultVersion: string;
|
|
21
|
+
isSolution: boolean;
|
|
22
|
+
private initializeOptions;
|
|
23
|
+
private store;
|
|
24
|
+
private otherParams;
|
|
25
|
+
private cacheId;
|
|
26
|
+
private window;
|
|
27
|
+
private request;
|
|
28
|
+
private itemRuleEvaluator;
|
|
29
|
+
private itemRuleConfigs;
|
|
30
|
+
private itemRuleConfigsPromise;
|
|
31
|
+
private itemRulePrefillApplied;
|
|
32
|
+
private itemRuleRuntimeConfig;
|
|
33
|
+
private resourceProductMap;
|
|
34
|
+
private loginEffectDisposers;
|
|
35
|
+
private customerLoginRefreshInFlight;
|
|
36
|
+
private customerLoginRefreshIdInFlight;
|
|
37
|
+
private loadAllProductsInFlight;
|
|
38
|
+
private productsLoaded;
|
|
39
|
+
private loadOpenDataConfigInFlight;
|
|
40
|
+
private static readonly OPEN_DATA_CACHE_TTL;
|
|
41
|
+
private getLoggerContext;
|
|
42
|
+
private serializeError;
|
|
43
|
+
private addVenueBookingLog;
|
|
44
|
+
private logMethodStart;
|
|
45
|
+
private logMethodSuccess;
|
|
46
|
+
private logMethodError;
|
|
47
|
+
addLog(params: VenueBookingAddLogParams): Promise<void>;
|
|
48
|
+
constructor(name?: string, version?: string);
|
|
49
|
+
private normalizeCustomerId;
|
|
50
|
+
private resolveCustomerIdFromLoginPayload;
|
|
51
|
+
private clearLoginEffectListeners;
|
|
52
|
+
private registerLoginEffect;
|
|
53
|
+
private registerCustomerLoginListeners;
|
|
54
|
+
private refreshOrderMarketingAfterLogin;
|
|
55
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
56
|
+
destroy(): Promise<void>;
|
|
57
|
+
retryInit(): Promise<void>;
|
|
58
|
+
refresh(): Promise<void>;
|
|
59
|
+
getStatus(): import("./types").VenueBookingStatus;
|
|
60
|
+
getEntryContext(): import("./types").VenueBookingEntryContext | null;
|
|
61
|
+
getItemRuleQuantityLimits(): QuantityLimitResult[];
|
|
62
|
+
getCartValidationPassed(): boolean | null;
|
|
63
|
+
getCartValidation(): {
|
|
64
|
+
passed: boolean | null;
|
|
65
|
+
failures: QuantityCheckResult[];
|
|
66
|
+
};
|
|
67
|
+
loadAllProducts(): Promise<{
|
|
68
|
+
venueProducts: ProductData[];
|
|
69
|
+
addonProducts: ProductData[];
|
|
70
|
+
}>;
|
|
71
|
+
private _doLoadAllProducts;
|
|
72
|
+
loadVenueProducts(): Promise<ProductData[]>;
|
|
73
|
+
loadAddonProducts(): Promise<ProductData[]>;
|
|
74
|
+
getVenueProducts(): ProductData[];
|
|
75
|
+
getAddonProductsList(): ProductData[];
|
|
76
|
+
loadQuotations(params?: {
|
|
77
|
+
channel?: string;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
fetchResourceAvailability(params: {
|
|
80
|
+
startDate: string;
|
|
81
|
+
endDate: string;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
getDateRangeSummary(params: {
|
|
84
|
+
startDate: string;
|
|
85
|
+
endDate: string;
|
|
86
|
+
}): VenueDateSummaryItem[];
|
|
87
|
+
getTimeSlotGrid(date: string): VenueTimeSlotGrid;
|
|
88
|
+
/**
|
|
89
|
+
* 切换单个时段的选中状态(选中/取消)。
|
|
90
|
+
* 内部自动处理连续时段的合并与拆分,订单是唯一真相源。
|
|
91
|
+
*/
|
|
92
|
+
toggleSlot(slot: VenueSlotSelection): Promise<ScanOrderOrderProduct[]>;
|
|
93
|
+
/**
|
|
94
|
+
* 获取某资源当前选中的所有独立时段(从订单中解析)。
|
|
95
|
+
*/
|
|
96
|
+
getSelectedSlotsForResource(resourceId: number | string): VenueSlotSelection[];
|
|
97
|
+
/**
|
|
98
|
+
* 判断某个时段是否已选中。
|
|
99
|
+
*/
|
|
100
|
+
isSlotSelected(resourceId: number | string, startTime: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* 获取所有已选时段(按资源分组)。
|
|
103
|
+
*/
|
|
104
|
+
getAllSelectedSlots(): Map<number | string, VenueSlotSelection[]>;
|
|
105
|
+
/**
|
|
106
|
+
* 对指定资源的订单商品进行 reconcile:
|
|
107
|
+
* 清除旧商品 → 合并连续时段 → 重新写入。
|
|
108
|
+
*/
|
|
109
|
+
private reconcileOrderForResource;
|
|
110
|
+
setSlotConfig(config: Partial<VenueBookingSlotConfig>): void;
|
|
111
|
+
getSlotConfig(): VenueBookingSlotConfig;
|
|
112
|
+
loadSchedules(): Promise<void>;
|
|
113
|
+
private injectScheduleResolverToQuotation;
|
|
114
|
+
getScheduleListByIds(ids: number[]): import("../../modules/Schedule/types").ScheduleItem[];
|
|
115
|
+
getTempOrder(): import("./types").ScanOrderTempOrder | null;
|
|
116
|
+
updateTempOrderNote(note: string): string;
|
|
117
|
+
updateTempOrderContactsInfo(contactsInfo: any[]): any[];
|
|
118
|
+
private ensureTempOrder;
|
|
119
|
+
onCustomerLogin(params: {
|
|
120
|
+
customerId: number;
|
|
121
|
+
}): Promise<void>;
|
|
122
|
+
private recalculateOrderPricesFromQuotation;
|
|
123
|
+
scanCode(code: string, customerId?: number): Promise<{
|
|
124
|
+
isAvailable: boolean;
|
|
125
|
+
discountList: import("../../modules/Discount").Discount[];
|
|
126
|
+
type: "server" | "clientCalc";
|
|
127
|
+
unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
/** 获取当前折扣列表(包装 order.getDiscountList) */
|
|
130
|
+
getDiscountList(): import("../../modules/Discount").Discount[];
|
|
131
|
+
/** 勾选/取消勾选某张折扣券,重新计算折扣并持久化 */
|
|
132
|
+
setDiscountSelected(params: {
|
|
133
|
+
discountId: number;
|
|
134
|
+
isSelected: boolean;
|
|
135
|
+
}): Promise<import("../../modules/Discount").Discount[]>;
|
|
136
|
+
addNewOrder(): Promise<import("./types").ScanOrderTempOrder>;
|
|
137
|
+
getOrderProducts(): ScanOrderOrderProduct[];
|
|
138
|
+
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
139
|
+
submitOrder<T = any>(): Promise<T>;
|
|
140
|
+
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
141
|
+
updateProductInOrder(params: {
|
|
142
|
+
product_id: number | null;
|
|
143
|
+
product_variant_id: number;
|
|
144
|
+
updates: Partial<ScanOrderOrderProduct>;
|
|
145
|
+
}): Promise<ScanOrderOrderProduct[]>;
|
|
146
|
+
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
147
|
+
getProductList(): Promise<ProductData[]>;
|
|
148
|
+
private loadOpenDataConfig;
|
|
149
|
+
private loadRuntimeConfigs;
|
|
150
|
+
private fetchItemRuleConfigsByModelIds;
|
|
151
|
+
private buildPrefillProductSourceMap;
|
|
152
|
+
private getItemRuleRuntimeConfig;
|
|
153
|
+
private ensureItemRuleConfigsLoaded;
|
|
154
|
+
private refreshItemRuleQuantityLimits;
|
|
155
|
+
private applyPrefillByItemRule;
|
|
156
|
+
applyItemRulePrefill(): Promise<void>;
|
|
157
|
+
private evaluateCartValidationByItemRule;
|
|
158
|
+
private validateBeforeSubmitByItemRule;
|
|
159
|
+
private refreshCartValidationPassed;
|
|
160
|
+
setItemRuleRuntimeConfig(config?: VenueBookingItemRuleRuntimeConfig): Promise<void>;
|
|
161
|
+
getOtherParams(): Record<string, any>;
|
|
162
|
+
checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
|
|
163
|
+
}
|