@pisell/pisellos 2.3.172 → 2.3.174
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +14 -8
- package/dist/modules/BookingContext/utils/productExtend.d.ts +5 -0
- package/dist/modules/BookingContext/utils/productExtend.js +61 -23
- package/dist/modules/Discount/index.js +0 -1
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +13 -0
- package/dist/modules/Order/index.d.ts +3 -25
- package/dist/modules/Order/index.js +1313 -1772
- package/dist/modules/Order/types.d.ts +0 -7
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/ProductList/index.js +12 -33
- package/dist/modules/Rules/index.d.ts +0 -2
- package/dist/modules/Rules/index.js +21 -29
- package/dist/solution/BaseSales/index.d.ts +1 -16
- package/dist/solution/BaseSales/index.js +1325 -1511
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +108 -200
- package/dist/solution/BookingTicket/types.d.ts +2 -14
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -4
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +1 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +23 -2
- package/dist/solution/UnifiedBookingSales/index.js +923 -683
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/utils/platform.d.ts +0 -2
- package/dist/utils/platform.js +0 -6
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -12
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +13 -7
- package/lib/modules/BookingContext/utils/productExtend.d.ts +5 -0
- package/lib/modules/BookingContext/utils/productExtend.js +36 -3
- package/lib/modules/Discount/index.js +0 -1
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +13 -0
- package/lib/modules/Order/index.d.ts +3 -25
- package/lib/modules/Order/index.js +38 -192
- package/lib/modules/Order/types.d.ts +0 -7
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/ProductList/index.js +0 -15
- package/lib/modules/Rules/index.d.ts +0 -2
- package/lib/modules/Rules/index.js +0 -6
- package/lib/solution/BaseSales/index.d.ts +1 -16
- package/lib/solution/BaseSales/index.js +9 -89
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +2 -38
- package/lib/solution/BookingTicket/types.d.ts +2 -14
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +3 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +1 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +23 -2
- package/lib/solution/UnifiedBookingSales/index.js +131 -15
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/utils/platform.d.ts +0 -2
- package/lib/utils/platform.js +0 -7
- package/package.json +1 -1
- package/dist/inventory/index.d.ts +0 -92
- package/dist/inventory/index.js +0 -509
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +0 -15
- package/dist/modules/Order/utils/productVoucherGroups.js +0 -115
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -117
- package/lib/inventory/index.d.ts +0 -92
- package/lib/inventory/index.js +0 -287
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +0 -15
- package/lib/modules/Order/utils/productVoucherGroups.js +0 -64
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +0 -10
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +0 -71
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -180,7 +180,8 @@ export declare class PromotionEvaluator {
|
|
|
180
180
|
*/
|
|
181
181
|
private processItemReward;
|
|
182
182
|
private normalizePositiveInteger;
|
|
183
|
-
|
|
183
|
+
/** 仅放开 X件Y元处理过的触发数量,奖励目标仍按全部已处理数量互斥。 */
|
|
184
|
+
private getItemRewardTriggerQuantity;
|
|
184
185
|
private buildItemRewardTargetUnits;
|
|
185
186
|
private resolveItemRewardFinalPrice;
|
|
186
187
|
private resolveItemRewardLimit;
|
|
@@ -375,6 +375,8 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
375
375
|
// 3. 追踪已处理的商品(避免重复处理)
|
|
376
376
|
// key: `${product_id}_${product_variant_id}`
|
|
377
377
|
var processedQuantityMap = new Map();
|
|
378
|
+
// X件Y元处理过的数量仍可作为商品奖励的触发条件。
|
|
379
|
+
var xItemsProcessedQuantityMap = new Map();
|
|
378
380
|
|
|
379
381
|
// 4. 处理每个促销组,收集结果
|
|
380
382
|
var pricedProducts = [];
|
|
@@ -392,7 +394,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
392
394
|
var matchedBundleIndexMap = group.productMatchedBundleIndexMap || new Map();
|
|
393
395
|
if (actionType === PROMOTION_ACTION_TYPES.X_ITEMS_FOR_Y_PRICE) {
|
|
394
396
|
// X件Y元处理
|
|
395
|
-
var result = this.processXItemsForYPrice(group, processedQuantityMap, matchedBundleIndexMap);
|
|
397
|
+
var result = this.processXItemsForYPrice(group, processedQuantityMap, xItemsProcessedQuantityMap, matchedBundleIndexMap);
|
|
396
398
|
pricedProducts.push.apply(pricedProducts, _toConsumableArray(result.products));
|
|
397
399
|
totalOriginalAmount = totalOriginalAmount.plus(result.originalAmount);
|
|
398
400
|
totalFinalAmount = totalFinalAmount.plus(result.finalAmount);
|
|
@@ -409,7 +411,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
409
411
|
}
|
|
410
412
|
} else if (actionType === PROMOTION_ACTION_TYPES.ITEM_REWARD) {
|
|
411
413
|
// 商品奖励处理:条件商品触发,目标商品行享优惠,不自动新增商品
|
|
412
|
-
var _result2 = this.processItemReward(group, processedQuantityMap, products, matchedBundleIndexMap);
|
|
414
|
+
var _result2 = this.processItemReward(group, processedQuantityMap, products, xItemsProcessedQuantityMap, matchedBundleIndexMap);
|
|
413
415
|
pricedProducts.push.apply(pricedProducts, _toConsumableArray(_result2.products));
|
|
414
416
|
totalOriginalAmount = totalOriginalAmount.plus(_result2.originalAmount);
|
|
415
417
|
totalFinalAmount = totalFinalAmount.plus(_result2.finalAmount);
|
|
@@ -689,7 +691,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
689
691
|
*/
|
|
690
692
|
}, {
|
|
691
693
|
key: "processXItemsForYPrice",
|
|
692
|
-
value: function processXItemsForYPrice(group, processedQuantityMap, matchedBundleIndexMap) {
|
|
694
|
+
value: function processXItemsForYPrice(group, processedQuantityMap, xItemsProcessedQuantityMap, matchedBundleIndexMap) {
|
|
693
695
|
var strategyId = group.strategyId,
|
|
694
696
|
strategyMetadata = group.strategyMetadata,
|
|
695
697
|
actionDetail = group.actionDetail,
|
|
@@ -911,6 +913,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
911
913
|
|
|
912
914
|
// 更新已处理数量
|
|
913
915
|
processedQuantityMap.set(_key, _processedQty + _availableQty);
|
|
916
|
+
xItemsProcessedQuantityMap.set(_key, (xItemsProcessedQuantityMap.get(_key) || 0) + _availableQty);
|
|
914
917
|
}
|
|
915
918
|
|
|
916
919
|
// 8. 尾差调整:只补实际组价的舍入差额,不将高于原价的组价补到某一件。
|
|
@@ -1117,7 +1120,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1117
1120
|
*/
|
|
1118
1121
|
}, {
|
|
1119
1122
|
key: "processItemReward",
|
|
1120
|
-
value: function processItemReward(group, processedQuantityMap, allProducts, matchedBundleIndexMap) {
|
|
1123
|
+
value: function processItemReward(group, processedQuantityMap, allProducts, xItemsProcessedQuantityMap, matchedBundleIndexMap) {
|
|
1121
1124
|
var _this4 = this;
|
|
1122
1125
|
var strategyId = group.strategyId,
|
|
1123
1126
|
strategyMetadata = group.strategyMetadata,
|
|
@@ -1126,7 +1129,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1126
1129
|
var detail = actionDetail;
|
|
1127
1130
|
var triggerQuantity = this.normalizePositiveInteger(detail.triggerQuantity, 1);
|
|
1128
1131
|
var rewardQuantity = this.normalizePositiveInteger(detail.rewardQuantity, 1);
|
|
1129
|
-
var conditionQuantity = this.
|
|
1132
|
+
var conditionQuantity = this.getItemRewardTriggerQuantity(triggerProducts, processedQuantityMap, xItemsProcessedQuantityMap, matchedBundleIndexMap);
|
|
1130
1133
|
if (conditionQuantity < triggerQuantity) {
|
|
1131
1134
|
return {
|
|
1132
1135
|
products: [],
|
|
@@ -1242,9 +1245,11 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1242
1245
|
var n = Math.floor(Number(value));
|
|
1243
1246
|
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
1244
1247
|
}
|
|
1248
|
+
|
|
1249
|
+
/** 仅放开 X件Y元处理过的触发数量,奖励目标仍按全部已处理数量互斥。 */
|
|
1245
1250
|
}, {
|
|
1246
|
-
key: "
|
|
1247
|
-
value: function
|
|
1251
|
+
key: "getItemRewardTriggerQuantity",
|
|
1252
|
+
value: function getItemRewardTriggerQuantity(products, processedQuantityMap, xItemsProcessedQuantityMap, matchedBundleIndexMap) {
|
|
1248
1253
|
var total = 0;
|
|
1249
1254
|
var _iterator19 = _createForOfIteratorHelper(products),
|
|
1250
1255
|
_step19;
|
|
@@ -1253,7 +1258,8 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1253
1258
|
var product = _step19.value;
|
|
1254
1259
|
var key = this.getProductKey(product);
|
|
1255
1260
|
var processedQty = processedQuantityMap.get(key) || 0;
|
|
1256
|
-
var
|
|
1261
|
+
var xItemsProcessedQty = xItemsProcessedQuantityMap.get(key) || 0;
|
|
1262
|
+
var availableQty = product.quantity - processedQty + xItemsProcessedQty;
|
|
1257
1263
|
if (availableQty <= 0) continue;
|
|
1258
1264
|
var matchedBundleIndex = matchedBundleIndexMap === null || matchedBundleIndexMap === void 0 ? void 0 : matchedBundleIndexMap.get(product.id);
|
|
1259
1265
|
if (matchedBundleIndex !== undefined && product.bundle) {
|
|
@@ -24,6 +24,10 @@ export interface BookingCalcContext {
|
|
|
24
24
|
date?: any;
|
|
25
25
|
/** 上一个服务行(getServiceStartTimeAndEndTime 拼接续接 start_time 用)。可缺省。 */
|
|
26
26
|
previousService?: any;
|
|
27
|
+
/** UBS-only default-time policy. Other solutions retain their existing Board behavior. */
|
|
28
|
+
resolveDefaultBookingStart?: (cacheItem: any, fallback: string) => string | undefined;
|
|
29
|
+
/** Explicit holder context supplied before the cache item has received its holder snapshot. */
|
|
30
|
+
holderIds?: unknown;
|
|
27
31
|
/** 日历选中的资源 id(替代 info2 sessionStorage.serviceParams.resource_id)。 */
|
|
28
32
|
resourceIdFromCalendar?: number;
|
|
29
33
|
/** 资源自动分派开关(替代 info2 localStorage 'resource-auto-allocation');默认全开。 */
|
|
@@ -58,6 +62,7 @@ export declare function getServiceStartTimeAndEndTime(params: {
|
|
|
58
62
|
cacheItem: any;
|
|
59
63
|
timeObj: TimeSlicesResult;
|
|
60
64
|
ctx: BookingCalcContext;
|
|
65
|
+
defaultBookingStartFallback?: string;
|
|
61
66
|
}): any;
|
|
62
67
|
/**
|
|
63
68
|
* 综合:把 cacheItem 拼装出完整的 _extend / _data(资源 / 容量 / timeObj),并标记 autoClose。
|
|
@@ -136,6 +136,12 @@ export function getTimeObj(params) {
|
|
|
136
136
|
durationSlicesBasedOnTime: durationSlicesBasedOnTime
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
+
function getDefaultBookingStartFallback(cacheItem, ctx) {
|
|
140
|
+
var _ref, _cacheItem$_extend$st, _cacheItem$_extend4;
|
|
141
|
+
var date = dayjs((_ref = (_cacheItem$_extend$st = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend4 = cacheItem._extend) === null || _cacheItem$_extend4 === void 0 ? void 0 : _cacheItem$_extend4.start_date) !== null && _cacheItem$_extend$st !== void 0 ? _cacheItem$_extend$st : ctx.date) !== null && _ref !== void 0 ? _ref : dayjs()).format('YYYY-MM-DD');
|
|
142
|
+
var time = ctx.presetStartTime || cacheItem.currentDefaultTime || dayjs().format('HH:mm');
|
|
143
|
+
return "".concat(date, "T").concat(time);
|
|
144
|
+
}
|
|
139
145
|
|
|
140
146
|
/**
|
|
141
147
|
* 计算商品行 _extend(包含 start_time / endDate / duration / start_date / end_date / sub_type 等)。
|
|
@@ -145,7 +151,7 @@ export function getTimeObj(params) {
|
|
|
145
151
|
* - cacheItem.isCustomItem → 直接返回 `{ duration: null }`。
|
|
146
152
|
*/
|
|
147
153
|
export function getServiceStartTimeAndEndTime(params) {
|
|
148
|
-
var _cacheItem$
|
|
154
|
+
var _cacheItem$_extend5, _cacheItem$_extend6, _cacheItem$_extend8;
|
|
149
155
|
var cacheItem = params.cacheItem,
|
|
150
156
|
timeObj = params.timeObj,
|
|
151
157
|
ctx = params.ctx;
|
|
@@ -154,7 +160,7 @@ export function getServiceStartTimeAndEndTime(params) {
|
|
|
154
160
|
duration: null
|
|
155
161
|
};
|
|
156
162
|
}
|
|
157
|
-
var appointmentTimingPreference = getAppointmentTimingPreference(ctx);
|
|
163
|
+
var appointmentTimingPreference = ctx.resolveDefaultBookingStart ? undefined : getAppointmentTimingPreference(ctx);
|
|
158
164
|
var lastServer = ctx.previousService || null;
|
|
159
165
|
var resolveDuration = function resolveDuration() {
|
|
160
166
|
var _cacheItem$duration;
|
|
@@ -164,7 +170,15 @@ export function getServiceStartTimeAndEndTime(params) {
|
|
|
164
170
|
var _extend = {
|
|
165
171
|
duration: resolveDuration()
|
|
166
172
|
};
|
|
167
|
-
if (
|
|
173
|
+
if (ctx.resolveDefaultBookingStart && !ctx.rememberedTime && !((_cacheItem$_extend5 = cacheItem._extend) !== null && _cacheItem$_extend5 !== void 0 && _cacheItem$_extend5.start_time) && !isSessionProduct(cacheItem)) {
|
|
174
|
+
var _params$defaultBookin;
|
|
175
|
+
var _fallback = (_params$defaultBookin = params.defaultBookingStartFallback) !== null && _params$defaultBookin !== void 0 ? _params$defaultBookin : getDefaultBookingStartFallback(cacheItem, ctx);
|
|
176
|
+
var start = ctx.resolveDefaultBookingStart(cacheItem, _fallback);
|
|
177
|
+
if (start) {
|
|
178
|
+
_extend.start_date = start.slice(0, 10);
|
|
179
|
+
_extend.start_time = start.slice(11);
|
|
180
|
+
}
|
|
181
|
+
} else if (lastServer) {
|
|
168
182
|
var _lastServer$_extend, _lastServer$_extend2;
|
|
169
183
|
var lastStart = (_lastServer$_extend = lastServer._extend) === null || _lastServer$_extend === void 0 ? void 0 : _lastServer$_extend.startDate;
|
|
170
184
|
var lastEnd = (_lastServer$_extend2 = lastServer._extend) === null || _lastServer$_extend2 === void 0 ? void 0 : _lastServer$_extend2.endDate;
|
|
@@ -188,7 +202,20 @@ export function getServiceStartTimeAndEndTime(params) {
|
|
|
188
202
|
_extend.start_time = dayjs().format('HH:mm');
|
|
189
203
|
}
|
|
190
204
|
}
|
|
205
|
+
var defaultStartDate = _extend.start_date;
|
|
191
206
|
_extend = _objectSpread(_objectSpread({}, _extend), cacheItem._extend);
|
|
207
|
+
// start_date on a new cache item is a calendar anchor, not a manually selected time.
|
|
208
|
+
// Preserve the complete default after a previous booking crossed midnight.
|
|
209
|
+
if (defaultStartDate && !((_cacheItem$_extend6 = cacheItem._extend) !== null && _cacheItem$_extend6 !== void 0 && _cacheItem$_extend6.start_time)) {
|
|
210
|
+
var _cacheItem$_extend7;
|
|
211
|
+
_extend.start_date = defaultStartDate;
|
|
212
|
+
if (isMultiDayProduct(cacheItem) && (_cacheItem$_extend7 = cacheItem._extend) !== null && _cacheItem$_extend7 !== void 0 && _cacheItem$_extend7.end_date) {
|
|
213
|
+
var _cacheItem$_extend$st2;
|
|
214
|
+
var originalDate = dayjs((_cacheItem$_extend$st2 = cacheItem._extend.start_date) !== null && _cacheItem$_extend$st2 !== void 0 ? _cacheItem$_extend$st2 : ctx.date).startOf('day');
|
|
215
|
+
var shiftDays = dayjs(defaultStartDate).diff(originalDate, 'day');
|
|
216
|
+
_extend.end_date = dayjs(cacheItem._extend.end_date).add(shiftDays, 'day').format('YYYY-MM-DD');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
192
219
|
var _getServiceTimes = getServiceTimes(_objectSpread(_objectSpread({}, cacheItem), {}, {
|
|
193
220
|
_extend: _extend
|
|
194
221
|
})),
|
|
@@ -203,7 +230,7 @@ export function getServiceStartTimeAndEndTime(params) {
|
|
|
203
230
|
_extend.start_date = (_extend$start_date = _extend.start_date) !== null && _extend$start_date !== void 0 ? _extend$start_date : startDate;
|
|
204
231
|
_extend.end_date = (_extend$end_date = _extend.end_date) !== null && _extend$end_date !== void 0 ? _extend$end_date : endDate;
|
|
205
232
|
}
|
|
206
|
-
var session = cacheItem === null || cacheItem === void 0 || (_cacheItem$
|
|
233
|
+
var session = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend8 = cacheItem._extend) === null || _cacheItem$_extend8 === void 0 || (_cacheItem$_extend8 = _cacheItem$_extend8.other) === null || _cacheItem$_extend8 === void 0 ? void 0 : _cacheItem$_extend8.session;
|
|
207
234
|
if (isSessionProduct(cacheItem) && session) {
|
|
208
235
|
var baseDate = ctx.date ? dayjs(ctx.date) : dayjs();
|
|
209
236
|
var startAt = dayjs("".concat(baseDate.format('YYYY-MM-DD'), " ").concat(dayjs(session.start_at).format('HH:mm:ss')));
|
|
@@ -228,7 +255,7 @@ export function getServiceStartTimeAndEndTime(params) {
|
|
|
228
255
|
* 入参 ctx 必须至少给:bookingConfig / resourcesOriginMap / resourcesOrigin / date。
|
|
229
256
|
*/
|
|
230
257
|
export function getProductExtend(params) {
|
|
231
|
-
var _cacheItem$
|
|
258
|
+
var _cacheItem$_extend9;
|
|
232
259
|
var isDisabledTime = params.isDisabledTime;
|
|
233
260
|
var hasRememberedTime = params.ctx.rememberedTime !== undefined;
|
|
234
261
|
var cacheItem = hasRememberedTime ? seedRememberedBookingStart(params.cacheItem, params.ctx) : params.cacheItem;
|
|
@@ -236,27 +263,38 @@ export function getProductExtend(params) {
|
|
|
236
263
|
previousService: undefined,
|
|
237
264
|
presetStartTime: undefined
|
|
238
265
|
}) : params.ctx;
|
|
239
|
-
var isNew = cacheItem.new || !((_cacheItem$
|
|
266
|
+
var isNew = cacheItem.new || !((_cacheItem$_extend9 = cacheItem._extend) !== null && _cacheItem$_extend9 !== void 0 && _cacheItem$_extend9.endDate);
|
|
240
267
|
var _cacheItem = _objectSpread({}, cacheItem);
|
|
241
268
|
var resourcesOriginMap = ctx.resourcesOriginMap || {};
|
|
242
269
|
_cacheItem._data = {};
|
|
243
270
|
if (isMultiDayProduct(cacheItem)) {
|
|
244
|
-
var _cacheItem$
|
|
271
|
+
var _cacheItem$_extend10;
|
|
245
272
|
_cacheItem._extend = _cacheItem._extend || {};
|
|
246
|
-
_cacheItem._extend.holder_id = (cacheItem === null || cacheItem === void 0 || (_cacheItem$
|
|
273
|
+
_cacheItem._extend.holder_id = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend10 = cacheItem._extend) === null || _cacheItem$_extend10 === void 0 ? void 0 : _cacheItem$_extend10.holder_id) || [];
|
|
247
274
|
_cacheItem._extend.sub_type = 'days';
|
|
248
275
|
}
|
|
249
276
|
if (isNew) {
|
|
250
|
-
var _ctx$bookingConfig3;
|
|
277
|
+
var _cacheItem$_data$sale, _cacheItem$_data, _ctx$bookingConfig3;
|
|
251
278
|
_cacheItem._data.timeObj = getTimeObj({
|
|
252
279
|
cacheItem: cacheItem,
|
|
253
280
|
ctx: ctx
|
|
254
281
|
});
|
|
282
|
+
var defaultBookingStartFallback = (_cacheItem$_data$sale = (_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.salesDefaultBookingFallback) !== null && _cacheItem$_data$sale !== void 0 ? _cacheItem$_data$sale : getDefaultBookingStartFallback(cacheItem, ctx);
|
|
255
283
|
_cacheItem._extend = getServiceStartTimeAndEndTime({
|
|
256
284
|
cacheItem: cacheItem,
|
|
257
285
|
timeObj: _cacheItem._data.timeObj,
|
|
258
|
-
ctx: ctx
|
|
286
|
+
ctx: ctx,
|
|
287
|
+
defaultBookingStartFallback: defaultBookingStartFallback
|
|
259
288
|
});
|
|
289
|
+
if (ctx.resolveDefaultBookingStart && !hasRememberedTime && !isSessionProduct(cacheItem)) {
|
|
290
|
+
var _cacheItem$_data2, _cacheItem$_extend11;
|
|
291
|
+
var start = "".concat(dayjs(_cacheItem._extend.start_date).format('YYYY-MM-DD'), "T").concat(_cacheItem._extend.start_time);
|
|
292
|
+
var previousDefault = (_cacheItem$_data2 = cacheItem._data) === null || _cacheItem$_data2 === void 0 ? void 0 : _cacheItem$_data2.salesDefaultBookingStart;
|
|
293
|
+
if (!((_cacheItem$_extend11 = cacheItem._extend) !== null && _cacheItem$_extend11 !== void 0 && _cacheItem$_extend11.start_time) || previousDefault && dayjs(start).valueOf() === dayjs(previousDefault).valueOf()) {
|
|
294
|
+
_cacheItem._data.salesDefaultBookingStart = start;
|
|
295
|
+
_cacheItem._data.salesDefaultBookingFallback = defaultBookingStartFallback;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
260
298
|
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
261
299
|
_cacheItem._data.resourcesOrigin = getResourceByIds(resourcesOriginMap, cacheItem, {
|
|
262
300
|
resourceTab: ctx === null || ctx === void 0 || (_ctx$bookingConfig3 = ctx.bookingConfig) === null || _ctx$bookingConfig3 === void 0 || (_ctx$bookingConfig3 = _ctx$bookingConfig3.config) === null || _ctx$bookingConfig3 === void 0 ? void 0 : _ctx$bookingConfig3.resource_tab,
|
|
@@ -304,14 +342,14 @@ export function getProductExtend(params) {
|
|
|
304
342
|
_cacheItem._time = new Date().getTime();
|
|
305
343
|
}
|
|
306
344
|
} else {
|
|
307
|
-
var _cacheItem$
|
|
345
|
+
var _cacheItem$_extend13;
|
|
308
346
|
if (!_cacheItem._data.capacitys) {
|
|
309
347
|
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
310
348
|
}
|
|
311
349
|
if (!_cacheItem._data.resourcesOrigin) {
|
|
312
|
-
var _cacheItem$
|
|
350
|
+
var _cacheItem$_extend12, _ctx$bookingConfig4;
|
|
313
351
|
var extraResources = [];
|
|
314
|
-
if (Array.isArray((_cacheItem$
|
|
352
|
+
if (Array.isArray((_cacheItem$_extend12 = _cacheItem._extend) === null || _cacheItem$_extend12 === void 0 ? void 0 : _cacheItem$_extend12.event_resources)) {
|
|
315
353
|
_cacheItem._extend.event_resources.forEach(function (er) {
|
|
316
354
|
extraResources.push({
|
|
317
355
|
form_id: er.form_id,
|
|
@@ -337,7 +375,7 @@ export function getProductExtend(params) {
|
|
|
337
375
|
}
|
|
338
376
|
_cacheItem._data.timeObj = getTimeObj({
|
|
339
377
|
cacheItem: _cacheItem,
|
|
340
|
-
useStartTime: (_cacheItem$
|
|
378
|
+
useStartTime: (_cacheItem$_extend13 = _cacheItem._extend) === null || _cacheItem$_extend13 === void 0 ? void 0 : _cacheItem$_extend13.start_time,
|
|
341
379
|
ctx: ctx
|
|
342
380
|
});
|
|
343
381
|
}
|
|
@@ -350,13 +388,13 @@ export function getProductExtend(params) {
|
|
|
350
388
|
* `getAutoAllocationStorage` 抽象为入参 `isAutoAllocationOn(formId)`。
|
|
351
389
|
*/
|
|
352
390
|
export function getIsAutoClose(cacheItem, isAutoAllocationOn) {
|
|
353
|
-
var _cacheItem$
|
|
391
|
+
var _cacheItem$_data3, _cacheItem$_extend14;
|
|
354
392
|
if (productNeedsResourceExtend(cacheItem) && !hasActualResourceSelection(cacheItem)) {
|
|
355
393
|
return false;
|
|
356
394
|
}
|
|
357
|
-
if (((_cacheItem$
|
|
358
|
-
var _cacheItem$
|
|
359
|
-
var resources = (cacheItem === null || cacheItem === void 0 || (_cacheItem$
|
|
395
|
+
if (((_cacheItem$_data3 = cacheItem._data) === null || _cacheItem$_data3 === void 0 || (_cacheItem$_data3 = _cacheItem$_data3.capacitys) === null || _cacheItem$_data3 === void 0 ? void 0 : _cacheItem$_data3.type) !== 'custom') {
|
|
396
|
+
var _cacheItem$_data4;
|
|
397
|
+
var resources = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_data4 = cacheItem._data) === null || _cacheItem$_data4 === void 0 ? void 0 : _cacheItem$_data4.resources) || [];
|
|
360
398
|
if (resources.length === 1) {
|
|
361
399
|
var _first$select_type;
|
|
362
400
|
var first = resources[0];
|
|
@@ -365,14 +403,14 @@ export function getIsAutoClose(cacheItem, isAutoAllocationOn) {
|
|
|
365
403
|
}
|
|
366
404
|
}
|
|
367
405
|
}
|
|
368
|
-
var entries = Object.entries(((_cacheItem$
|
|
406
|
+
var entries = Object.entries(((_cacheItem$_extend14 = cacheItem._extend) === null || _cacheItem$_extend14 === void 0 ? void 0 : _cacheItem$_extend14.resource) || {});
|
|
369
407
|
if (entries.length === 0) {
|
|
370
408
|
return !productNeedsResourceExtend(cacheItem);
|
|
371
409
|
}
|
|
372
|
-
return entries.every(function (
|
|
373
|
-
var
|
|
374
|
-
key =
|
|
375
|
-
value =
|
|
410
|
+
return entries.every(function (_ref2) {
|
|
411
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
412
|
+
key = _ref3[0],
|
|
413
|
+
value = _ref3[1];
|
|
376
414
|
return isAutoAllocationOn(key) && Array.isArray(value) && value.length > 0;
|
|
377
415
|
});
|
|
378
416
|
}
|
|
@@ -265,7 +265,6 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
265
265
|
_context5.next = 3;
|
|
266
266
|
return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
|
|
267
267
|
code: code,
|
|
268
|
-
resolve_ticket_order: 1,
|
|
269
268
|
translate_flag: 1,
|
|
270
269
|
tags: ['entitlement_pass', 'good_pass', 'product_discount_card'],
|
|
271
270
|
// available: 1,
|
|
@@ -4,6 +4,7 @@ import type { ScheduleModule } from '../Schedule';
|
|
|
4
4
|
import type { OpenDataConfig, OpenDataFetchParams, OpenDataAvailabilityResult, InvoiceLayoutConfig, InvoiceTemplateSettings } from './types';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export * from './contactInfo';
|
|
7
|
+
export * from './salesSettings';
|
|
7
8
|
export { computeAvailability, getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeInvoiceLayoutConfig, normalizeInvoiceLayoutFromTemplateSettings, normalizeInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales, } from './utils';
|
|
8
9
|
export declare class OpenDataModule extends BaseModule implements Module {
|
|
9
10
|
protected defaultName: string;
|
|
@@ -19,6 +19,7 @@ import { BaseModule } from "../BaseModule";
|
|
|
19
19
|
import { computeAvailability, getDefaultInvoiceTemplateSettings, normalizeInvoiceLayoutFromTemplateSettings, normalizeInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings } from "./utils";
|
|
20
20
|
export * from "./types";
|
|
21
21
|
export * from "./contactInfo";
|
|
22
|
+
export * from "./salesSettings";
|
|
22
23
|
export { computeAvailability, getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeInvoiceLayoutConfig, normalizeInvoiceLayoutFromTemplateSettings, normalizeInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales } from "./utils";
|
|
23
24
|
function isRecord(value) {
|
|
24
25
|
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MultiLangObject, OpenDataConfig } from './types';
|
|
2
|
+
export type MultipleBookingScheduling = 'one_after_another' | 'same_start_time';
|
|
3
|
+
export type ResourceSelectionMode = 'customer_optional' | 'customer_required' | 'automatic';
|
|
4
|
+
export interface SalesResourceSetting {
|
|
5
|
+
name?: string | MultiLangObject;
|
|
6
|
+
resourceSelectionMode: ResourceSelectionMode;
|
|
7
|
+
skipResourceSelectionIfSingle: boolean;
|
|
8
|
+
autoAssignmentRule: 'optimal_idle_time';
|
|
9
|
+
}
|
|
10
|
+
export interface ResolvedSalesSettings {
|
|
11
|
+
cart: {
|
|
12
|
+
showProductImage: boolean;
|
|
13
|
+
showRemoveButton: boolean;
|
|
14
|
+
};
|
|
15
|
+
product: {
|
|
16
|
+
checkRequiredOptions: boolean;
|
|
17
|
+
};
|
|
18
|
+
stock: {
|
|
19
|
+
checkStock: boolean;
|
|
20
|
+
allowInsufficientStock: boolean;
|
|
21
|
+
showDontRemindAgainToday: boolean;
|
|
22
|
+
};
|
|
23
|
+
reservation: {
|
|
24
|
+
multipleBookingScheduling: MultipleBookingScheduling;
|
|
25
|
+
resourceSettings: Record<string, SalesResourceSetting>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare const DEFAULT_SALES_RESOURCE_SETTING: Readonly<SalesResourceSetting>;
|
|
29
|
+
/** PiCoding stores this field as a form-ID map despite its administration schema's array declaration. */
|
|
30
|
+
export declare function normalizeSalesResourceSettings(value: unknown): Record<string, SalesResourceSetting>;
|
|
31
|
+
/** Normalize a successfully loaded OpenData snapshot; callers must propagate loading failures. */
|
|
32
|
+
export declare function normalizeSalesSettings(raw: OpenDataConfig | null | undefined, platform: unknown): ResolvedSalesSettings;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
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); }
|
|
13
|
+
import { normalizeRuntimePlatform } from "../../utils/platform";
|
|
14
|
+
export var DEFAULT_SALES_RESOURCE_SETTING = Object.freeze({
|
|
15
|
+
resourceSelectionMode: 'customer_optional',
|
|
16
|
+
skipResourceSelectionIfSingle: true,
|
|
17
|
+
autoAssignmentRule: 'optimal_idle_time'
|
|
18
|
+
});
|
|
19
|
+
function isRecord(value) {
|
|
20
|
+
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
21
|
+
}
|
|
22
|
+
function booleanOr(value, fallback) {
|
|
23
|
+
return typeof value === 'boolean' ? value : fallback;
|
|
24
|
+
}
|
|
25
|
+
function normalizeResourceName(value) {
|
|
26
|
+
if (typeof value === 'string') return value.trim() ? value : undefined;
|
|
27
|
+
if (!isRecord(value)) return undefined;
|
|
28
|
+
var entries = Object.entries(value).filter(function (_ref) {
|
|
29
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
30
|
+
text = _ref2[1];
|
|
31
|
+
return typeof text === 'string' && text.trim();
|
|
32
|
+
});
|
|
33
|
+
return entries.length ? Object.fromEntries(entries) : undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** PiCoding stores this field as a form-ID map despite its administration schema's array declaration. */
|
|
37
|
+
export function normalizeSalesResourceSettings(value) {
|
|
38
|
+
if (!isRecord(value)) return {};
|
|
39
|
+
var entries = Object.entries(value).flatMap(function (_ref3) {
|
|
40
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
41
|
+
formId = _ref4[0],
|
|
42
|
+
setting = _ref4[1];
|
|
43
|
+
if (!/^[1-9]\d*$/.test(formId) || !isRecord(setting)) return [];
|
|
44
|
+
var name = normalizeResourceName(setting.name);
|
|
45
|
+
var mode = setting.resourceSelectionMode;
|
|
46
|
+
return [[formId, _objectSpread(_objectSpread({}, name === undefined ? {} : {
|
|
47
|
+
name: name
|
|
48
|
+
}), {}, {
|
|
49
|
+
resourceSelectionMode: mode === 'customer_required' || mode === 'automatic' ? mode : 'customer_optional',
|
|
50
|
+
skipResourceSelectionIfSingle: booleanOr(setting.skipResourceSelectionIfSingle, true),
|
|
51
|
+
// No new allocation algorithm is introduced by this migration.
|
|
52
|
+
autoAssignmentRule: 'optimal_idle_time'
|
|
53
|
+
})]];
|
|
54
|
+
});
|
|
55
|
+
return Object.fromEntries(entries);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Normalize a successfully loaded OpenData snapshot; callers must propagate loading failures. */
|
|
59
|
+
export function normalizeSalesSettings(raw, platform) {
|
|
60
|
+
var runtimePlatform = normalizeRuntimePlatform(platform);
|
|
61
|
+
var isPos = runtimePlatform === 'pos' || runtimePlatform === 'webpos';
|
|
62
|
+
return {
|
|
63
|
+
cart: {
|
|
64
|
+
showProductImage: booleanOr(raw === null || raw === void 0 ? void 0 : raw['interface.show_product_image'], true),
|
|
65
|
+
showRemoveButton: isPos || booleanOr(raw === null || raw === void 0 ? void 0 : raw['interface.show_remove_button'], true)
|
|
66
|
+
},
|
|
67
|
+
product: {
|
|
68
|
+
checkRequiredOptions: booleanOr(raw === null || raw === void 0 ? void 0 : raw['sale.check_required_options'], true)
|
|
69
|
+
},
|
|
70
|
+
stock: {
|
|
71
|
+
checkStock: !isPos || booleanOr(raw === null || raw === void 0 ? void 0 : raw['sale.stock_settings'], true),
|
|
72
|
+
allowInsufficientStock: isPos && booleanOr(raw === null || raw === void 0 ? void 0 : raw['sale.allow_adding_insufficient_stock'], false),
|
|
73
|
+
showDontRemindAgainToday: isPos && booleanOr(raw === null || raw === void 0 ? void 0 : raw['sale.show_option'], false)
|
|
74
|
+
},
|
|
75
|
+
reservation: {
|
|
76
|
+
multipleBookingScheduling: (raw === null || raw === void 0 ? void 0 : raw['reservation.multiple_booking_scheduling']) === 'same_start_time' ? 'same_start_time' : 'one_after_another',
|
|
77
|
+
resourceSettings: normalizeSalesResourceSettings(raw === null || raw === void 0 ? void 0 : raw['reservation.resource_setting'])
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -67,7 +67,20 @@ export interface OpenDataConfig {
|
|
|
67
67
|
'reservation.auto_confirm_mode'?: string;
|
|
68
68
|
'reservation.auto_confirm_delay_seconds'?: number;
|
|
69
69
|
'reservation.time_slice'?: number | string;
|
|
70
|
+
'reservation.multiple_booking_scheduling'?: 'one_after_another' | 'same_start_time';
|
|
71
|
+
'reservation.resource_setting'?: Record<string, {
|
|
72
|
+
name?: string | MultiLangObject;
|
|
73
|
+
resourceSelectionMode?: 'customer_optional' | 'customer_required' | 'automatic';
|
|
74
|
+
skipResourceSelectionIfSingle?: boolean;
|
|
75
|
+
autoAssignmentRule?: 'optimal_idle_time';
|
|
76
|
+
}>;
|
|
77
|
+
'interface.show_product_image'?: boolean;
|
|
78
|
+
'interface.show_remove_button'?: boolean;
|
|
70
79
|
'sale.allow_item_notes'?: boolean;
|
|
80
|
+
'sale.check_required_options'?: boolean;
|
|
81
|
+
'sale.stock_settings'?: boolean;
|
|
82
|
+
'sale.allow_adding_insufficient_stock'?: boolean;
|
|
83
|
+
'sale.show_option'?: boolean;
|
|
71
84
|
'sale.allow_order_notes'?: boolean;
|
|
72
85
|
'sale.enable_contact_info'?: boolean;
|
|
73
86
|
'sale.first_name.visible'?: boolean;
|
|
@@ -4,8 +4,7 @@ import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrde
|
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
6
|
import { type PickupTimingBooking, type PickupTimingBookingInput } from './pickupTiming';
|
|
7
|
-
import {
|
|
8
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, OrderHooksConfig, OrderCartIntentCommitContext, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, PointCardSnapshotMergeContext, PointCardSnapshotItem, ShopServiceData, ShopServiceType } from './types';
|
|
7
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, OrderCartIntentCommitContext, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, PointCardSnapshotMergeContext, PointCardSnapshotItem, ShopServiceData, ShopServiceType } from './types';
|
|
9
8
|
import type { ICustomer } from '../AccountList/types';
|
|
10
9
|
import type { Discount } from '../Discount/types';
|
|
11
10
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -30,12 +29,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
30
29
|
private rulesHooksOverride?;
|
|
31
30
|
private moduleHooksOverride?;
|
|
32
31
|
private orderHooks?;
|
|
33
|
-
private cartCommandQueue;
|
|
34
|
-
private queueCartCommand;
|
|
35
|
-
/** Use the exact Order normalizers/merge rules on a private draft, not a second projection. */
|
|
36
|
-
private beginCartMutation;
|
|
37
|
-
/** Serializes checkout preparation with local cart commands; hydration remains outside this guard. */
|
|
38
|
-
prepareCheckout<T>(prepare: (items: OrderProduct[]) => Promise<T>): Promise<T>;
|
|
39
32
|
private otherParams?;
|
|
40
33
|
/** 评估器引用;由 SalesSdkProvider 注入,未注入时 applyPromotion 静默跳过 */
|
|
41
34
|
private promotionEvaluator;
|
|
@@ -73,11 +66,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
73
66
|
* @example
|
|
74
67
|
* orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
|
|
75
68
|
*/
|
|
76
|
-
updateOtherParams(params: Record<string, any
|
|
77
|
-
hooks?: OrderHooksConfig;
|
|
78
|
-
changedParams?: Record<string, any>;
|
|
79
|
-
cover?: boolean;
|
|
80
|
-
}): void;
|
|
69
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
81
70
|
/** Internal intent boundary shared with asynchronous scanner/detail flows. */
|
|
82
71
|
createCartIntentCommitGuard(action: OrderCartIntentCommitContext['action'], tempOrder?: OrderTempOrder | null): () => void;
|
|
83
72
|
/** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
|
|
@@ -95,8 +84,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
95
84
|
*/
|
|
96
85
|
private logError;
|
|
97
86
|
private registerDiscountModules;
|
|
98
|
-
setProductVoucherGroups(groups: ProductVoucherGroup[]): void;
|
|
99
|
-
validateProductVoucherSelection(): void;
|
|
100
87
|
private createDefaultRulesHooks;
|
|
101
88
|
/**
|
|
102
89
|
* Stable across notifyTempOrderChanged's immutable copy, but changes when a
|
|
@@ -115,9 +102,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
115
102
|
getCustomerWalletPrepareConfigEpoch(): number;
|
|
116
103
|
private syncScannedDiscountsToOriginalDiscountList;
|
|
117
104
|
private ensureEditDiscountConfigForProductChange;
|
|
118
|
-
scanCode(code: string, customerId?: number
|
|
119
|
-
productVouchersOnly?: boolean;
|
|
120
|
-
}): Promise<{
|
|
105
|
+
scanCode(code: string, customerId?: number): Promise<{
|
|
121
106
|
isAvailable: boolean;
|
|
122
107
|
isAccepted?: boolean;
|
|
123
108
|
discountList: Discount[];
|
|
@@ -497,7 +482,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
497
482
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
498
483
|
*/
|
|
499
484
|
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<OrderProduct[]>;
|
|
500
|
-
private addProductToOrderDraft;
|
|
501
485
|
/**
|
|
502
486
|
* 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
|
|
503
487
|
*
|
|
@@ -513,7 +497,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
513
497
|
}>, options?: {
|
|
514
498
|
skipEditDiscountConfigRefresh?: boolean;
|
|
515
499
|
}): Promise<OrderProduct[]>;
|
|
516
|
-
private addProductsToOrderDraft;
|
|
517
500
|
private getFullCoveragePassDiscounts;
|
|
518
501
|
private hasEntitlementPassDiscount;
|
|
519
502
|
private hasGoodPassDiscount;
|
|
@@ -525,13 +508,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
525
508
|
private isRestrictedCartProductUpdate;
|
|
526
509
|
private applyOrderProductUpdateToTempOrder;
|
|
527
510
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
|
|
528
|
-
private updateOrderProductDraft;
|
|
529
511
|
updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<OrderProduct[]>;
|
|
530
|
-
private updateOrderProductsDraft;
|
|
531
512
|
updateOrderProductQuantity(params: UpdateOrderProductQuantityParams, options?: {
|
|
532
513
|
isCurrentOrder?: () => boolean;
|
|
533
514
|
}): Promise<OrderProduct[]>;
|
|
534
|
-
private updateOrderProductQuantityDraft;
|
|
535
515
|
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|
|
536
516
|
/**
|
|
537
517
|
* 商品行写路径收尾:促销 → 折扣 → 清洗 → summary → 持久化。
|
|
@@ -548,14 +528,12 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
548
528
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
549
529
|
*/
|
|
550
530
|
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
551
|
-
private removeProductsFromOrderDraft;
|
|
552
531
|
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
553
532
|
/**
|
|
554
533
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
555
534
|
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
556
535
|
*/
|
|
557
536
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
558
|
-
private clearOrderCartLinesDraft;
|
|
559
537
|
/**
|
|
560
538
|
* 切换购物车结算单位时清理所有会影响新币种的订单状态,但保留当前客户。
|
|
561
539
|
*/
|