@pisell/pisellos 2.2.287 → 2.2.289
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/Rules/index.js +11 -8
- package/dist/modules/SalesSummary/index.js +6 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Sales/index.d.ts +4 -3
- package/dist/solution/Sales/index.js +23 -16
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Rules/index.js +8 -6
- package/lib/modules/SalesSummary/index.js +3 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Sales/index.d.ts +4 -3
- package/lib/solution/Sales/index.js +19 -14
- package/package.json +1 -1
|
@@ -2223,7 +2223,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2223
2223
|
}, {
|
|
2224
2224
|
key: "checkPackageSubItemUsageRules",
|
|
2225
2225
|
value: function checkPackageSubItemUsageRules(discount, flatItem) {
|
|
2226
|
-
var _flatItem$product;
|
|
2226
|
+
var _flatItem$product, _flatItem$originProdu, _flatItem$parentProdu10;
|
|
2227
2227
|
var limitedData = discount.limited_relation_product_data;
|
|
2228
2228
|
var usageRules = limitedData === null || limitedData === void 0 ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
2229
2229
|
var rules = ['original_price'].concat(_toConsumableArray((usageRules === null || usageRules === void 0 ? void 0 : usageRules.rules) || []));
|
|
@@ -2236,7 +2236,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2236
2236
|
// 套餐适用范围配置
|
|
2237
2237
|
var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
|
|
2238
2238
|
var _ref18 = packageScope || {},
|
|
2239
|
-
|
|
2239
|
+
_ref18$type = _ref18.type,
|
|
2240
|
+
scopeType = _ref18$type === void 0 ? 'product_all' : _ref18$type,
|
|
2240
2241
|
_ref18$exclude_bundle = _ref18.exclude_bundle_product_ids,
|
|
2241
2242
|
exclude_bundle_product_ids = _ref18$exclude_bundle === void 0 ? [] : _ref18$exclude_bundle,
|
|
2242
2243
|
_ref18$include_bundle = _ref18.include_bundle_product_ids,
|
|
@@ -2246,6 +2247,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2246
2247
|
var isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
2247
2248
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2248
2249
|
var bundleMainProductId = (_flatItem$product = flatItem.product) === null || _flatItem$product === void 0 ? void 0 : _flatItem$product.product_id;
|
|
2250
|
+
// 主商品id
|
|
2251
|
+
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 || (_flatItem$originProdu = _flatItem$originProdu._productOrigin) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu10 = flatItem.parentProduct) === null || _flatItem$parentProdu10 === void 0 ? void 0 : _flatItem$parentProdu10.id) || 0;
|
|
2249
2252
|
|
|
2250
2253
|
// 主商品直接可用
|
|
2251
2254
|
if (isMainProduct) {
|
|
@@ -2258,12 +2261,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2258
2261
|
return true; // 单独购买时可用
|
|
2259
2262
|
}
|
|
2260
2263
|
if (isBundleItem) {
|
|
2261
|
-
var _flatItem$bundleItem10, _flatItem$bundleItem11
|
|
2264
|
+
var _flatItem$bundleItem10, _flatItem$bundleItem11;
|
|
2262
2265
|
// 套餐中购买时,判断是否为原价
|
|
2263
2266
|
var priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
|
|
2264
2267
|
var priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
|
|
2265
2268
|
// 主商品id
|
|
2266
|
-
|
|
2269
|
+
// const mainProductId = flatItem?.originProduct?._productOrigin?.id || flatItem?.parentProduct?.id || 0;
|
|
2267
2270
|
// original_price 对应:
|
|
2268
2271
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
2269
2272
|
// markup_price 对应:
|
|
@@ -2288,13 +2291,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2288
2291
|
if (!filter) {
|
|
2289
2292
|
isScopeValid = true;
|
|
2290
2293
|
} else {
|
|
2291
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
2294
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
2292
2295
|
}
|
|
2293
2296
|
}
|
|
2294
2297
|
|
|
2295
2298
|
// 包含套餐判断, products值兼容旧数据
|
|
2296
2299
|
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2297
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
2300
|
+
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
2298
2301
|
}
|
|
2299
2302
|
|
|
2300
2303
|
// 价格和套餐适用范围都符合,则可用
|
|
@@ -2357,13 +2360,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2357
2360
|
if (!filter) {
|
|
2358
2361
|
_isScopeValid = true;
|
|
2359
2362
|
} else {
|
|
2360
|
-
_isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
2363
|
+
_isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
2361
2364
|
}
|
|
2362
2365
|
}
|
|
2363
2366
|
|
|
2364
2367
|
// 包含套餐判断, products值兼容旧数据
|
|
2365
2368
|
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2366
|
-
_isScopeValid = include_bundle_product_ids.includes(Number(
|
|
2369
|
+
_isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
2367
2370
|
}
|
|
2368
2371
|
|
|
2369
2372
|
// 价格和套餐适用范围都符合,则可用
|
|
@@ -212,8 +212,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
212
212
|
key: "getSummary",
|
|
213
213
|
value: function () {
|
|
214
214
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
215
|
-
var _this$store$surcharge, _ref;
|
|
216
|
-
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
215
|
+
var _this$otherParams2, _this$store$surcharge, _ref;
|
|
216
|
+
var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, fatherModuleName, scheduleModuleName, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
|
|
217
217
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
218
218
|
while (1) switch (_context4.prev = _context4.next) {
|
|
219
219
|
case 0:
|
|
@@ -227,7 +227,9 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
227
227
|
return this.getSurchargeList(summaryChannel);
|
|
228
228
|
case 5:
|
|
229
229
|
taxConfig = this.getTaxConfig();
|
|
230
|
-
|
|
230
|
+
fatherModuleName = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.fatherModule) || this.name.replace(/_salesSummary$/, '');
|
|
231
|
+
scheduleModuleName = "".concat(fatherModuleName, "_schedule");
|
|
232
|
+
summarySchedule = this.core.getModule(scheduleModuleName);
|
|
231
233
|
needScheduleIds = (((_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
|
|
232
234
|
return item.available_schedule_ids;
|
|
233
235
|
})) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.flat()) || []).filter(function (id) {
|
|
@@ -264,7 +266,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
264
266
|
});
|
|
265
267
|
this.store.summary = summaryWithTaxMeta;
|
|
266
268
|
return _context4.abrupt("return", summaryWithTaxMeta);
|
|
267
|
-
case
|
|
269
|
+
case 17:
|
|
268
270
|
case "end":
|
|
269
271
|
return _context4.stop();
|
|
270
272
|
}
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -334,7 +334,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
334
334
|
* 获取当前的客户搜索条件
|
|
335
335
|
* @returns 当前搜索条件
|
|
336
336
|
*/
|
|
337
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
337
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
338
338
|
/**
|
|
339
339
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
340
340
|
* @returns 客户状态
|
|
@@ -50,11 +50,12 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
50
50
|
*/
|
|
51
51
|
private getTimelineBucketMinutes;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* 解析 current 所属营业日窗口:
|
|
54
54
|
* - 当 operating_day_boundary.type === 'start_time'
|
|
55
|
-
*
|
|
55
|
+
* 使用「最近一个 boundary.time」到「下一个 boundary.time」
|
|
56
56
|
* - 否则回退自然日(00:00 到次日 00:00)
|
|
57
57
|
*/
|
|
58
|
+
private getOperatingDayRange;
|
|
58
59
|
private getTimelineRangeByOperatingBoundary;
|
|
59
60
|
/**
|
|
60
61
|
* 统计时间轴每个时间片的预约数量。
|
|
@@ -95,7 +96,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
95
96
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
96
97
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
97
98
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
98
|
-
* - includeAllFuture
|
|
99
|
+
* - includeAllFuture 时,保留选中预约并返回当前营业日全部后续预约;仅详情接口启用。
|
|
99
100
|
*/
|
|
100
101
|
private pickBookingsForCurrentPoint;
|
|
101
102
|
/**
|
|
@@ -258,19 +258,19 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
/**
|
|
261
|
-
*
|
|
261
|
+
* 解析 current 所属营业日窗口:
|
|
262
262
|
* - 当 operating_day_boundary.type === 'start_time'
|
|
263
|
-
*
|
|
263
|
+
* 使用「最近一个 boundary.time」到「下一个 boundary.time」
|
|
264
264
|
* - 否则回退自然日(00:00 到次日 00:00)
|
|
265
265
|
*/
|
|
266
266
|
}, {
|
|
267
|
-
key: "
|
|
268
|
-
value: function
|
|
269
|
-
var _appPlugin$getApp, _appPlugin$getApp$get, _appPlugin$getApp$get2, _appPlugin$getApp$get3, _coreData$core;
|
|
270
|
-
var
|
|
271
|
-
var defaultStart =
|
|
267
|
+
key: "getOperatingDayRange",
|
|
268
|
+
value: function getOperatingDayRange() {
|
|
269
|
+
var _this$core, _appPlugin$getApp, _appPlugin$getApp$get, _appPlugin$getApp$get2, _appPlugin$getApp$get3, _coreData$core;
|
|
270
|
+
var referenceTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dayjs();
|
|
271
|
+
var defaultStart = referenceTime.startOf('day');
|
|
272
272
|
var defaultEndExclusive = defaultStart.add(1, 'day');
|
|
273
|
-
var appPlugin = this.core.getPlugin('app');
|
|
273
|
+
var appPlugin = (_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.getPlugin('app');
|
|
274
274
|
var coreData = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp()) === null || _appPlugin$getApp === void 0 || (_appPlugin$getApp = _appPlugin$getApp.data) === null || _appPlugin$getApp === void 0 || (_appPlugin$getApp = _appPlugin$getApp.store) === null || _appPlugin$getApp === void 0 || (_appPlugin$getApp$get = _appPlugin$getApp.getStore) === null || _appPlugin$getApp$get === void 0 || (_appPlugin$getApp$get2 = (_appPlugin$getApp$get3 = _appPlugin$getApp$get.call(_appPlugin$getApp)).getDataByModel) === null || _appPlugin$getApp$get2 === void 0 ? void 0 : _appPlugin$getApp$get2.call(_appPlugin$getApp$get3, 'core');
|
|
275
275
|
var operatingDayBoundary = coreData === null || coreData === void 0 || (_coreData$core = coreData.core) === null || _coreData$core === void 0 ? void 0 : _coreData$core.operating_day_boundary;
|
|
276
276
|
if ((operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.type) !== 'start_time') {
|
|
@@ -280,18 +280,24 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
282
|
var boundaryTime = String(operatingDayBoundary.time || '').trim();
|
|
283
|
-
var
|
|
284
|
-
if (!
|
|
283
|
+
var boundaryStart = dayjs("".concat(referenceTime.format('YYYY-MM-DD'), " ").concat(boundaryTime));
|
|
284
|
+
if (!boundaryStart.isValid()) {
|
|
285
285
|
return {
|
|
286
286
|
startAt: defaultStart,
|
|
287
287
|
endExclusiveAt: defaultEndExclusive
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
|
+
var startAt = referenceTime.isBefore(boundaryStart) ? boundaryStart.subtract(1, 'day') : boundaryStart;
|
|
290
291
|
return {
|
|
291
292
|
startAt: startAt,
|
|
292
293
|
endExclusiveAt: startAt.add(1, 'day')
|
|
293
294
|
};
|
|
294
295
|
}
|
|
296
|
+
}, {
|
|
297
|
+
key: "getTimelineRangeByOperatingBoundary",
|
|
298
|
+
value: function getTimelineRangeByOperatingBoundary() {
|
|
299
|
+
return this.getOperatingDayRange();
|
|
300
|
+
}
|
|
295
301
|
|
|
296
302
|
/**
|
|
297
303
|
* 统计时间轴每个时间片的预约数量。
|
|
@@ -485,7 +491,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
485
491
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
486
492
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
487
493
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
488
|
-
* - includeAllFuture
|
|
494
|
+
* - includeAllFuture 时,保留选中预约并返回当前营业日全部后续预约;仅详情接口启用。
|
|
489
495
|
*/
|
|
490
496
|
}, {
|
|
491
497
|
key: "pickBookingsForCurrentPoint",
|
|
@@ -493,15 +499,16 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
493
499
|
var _this4 = this;
|
|
494
500
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
495
501
|
if (bookings.length === 0) return [];
|
|
496
|
-
var
|
|
497
|
-
|
|
502
|
+
var _this$getOperatingDay = this.getOperatingDayRange(current),
|
|
503
|
+
operatingDayStart = _this$getOperatingDay.startAt,
|
|
504
|
+
operatingDayEndExclusive = _this$getOperatingDay.endExclusiveAt;
|
|
498
505
|
|
|
499
|
-
// 仅保留与 current
|
|
506
|
+
// 仅保留与 current 所属营业日窗口有时间交集的预约,避免跨营业日误命中
|
|
500
507
|
var dayScopedBookings = bookings.filter(function (booking) {
|
|
501
508
|
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
502
509
|
var endAt = _this4.toBookingDateTime(booking.end_date, booking.end_time);
|
|
503
510
|
if (!startAt.isValid() || !endAt.isValid()) return false;
|
|
504
|
-
return
|
|
511
|
+
return startAt.isBefore(operatingDayEndExclusive) && _this4.isSameOrAfter(endAt, operatingDayStart);
|
|
505
512
|
});
|
|
506
513
|
if (dayScopedBookings.length === 0) return [];
|
|
507
514
|
var appendNextStartGroupIfNeeded = function appendNextStartGroupIfNeeded(selectedBookings) {
|
|
@@ -560,7 +567,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
560
567
|
// upcoming: 从未来预约里只取最早那一组(同 start_time)
|
|
561
568
|
var upcoming = dayScopedBookings.filter(function (booking) {
|
|
562
569
|
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
563
|
-
return startAt.isValid() && startAt.isAfter(current)
|
|
570
|
+
return startAt.isValid() && startAt.isAfter(current);
|
|
564
571
|
});
|
|
565
572
|
if (upcoming.length > 0) {
|
|
566
573
|
if (options.includeAllFuture) return upcoming;
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _adapter.PromotionAdapter;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _evaluator.PromotionEvaluator;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "default", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _adapter.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var _evaluator = require("./evaluator");
|
|
43
|
-
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
-
var _examples = require("./examples");
|
|
45
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
1
|
+
"use strict";
|
|
@@ -1961,7 +1961,7 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
1961
1961
|
// 套餐适用范围配置
|
|
1962
1962
|
const packageScope = usageRules?.package_scope;
|
|
1963
1963
|
const {
|
|
1964
|
-
type: scopeType,
|
|
1964
|
+
type: scopeType = 'product_all',
|
|
1965
1965
|
exclude_bundle_product_ids = [],
|
|
1966
1966
|
include_bundle_product_ids = [],
|
|
1967
1967
|
filter = 0
|
|
@@ -1969,6 +1969,8 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
1969
1969
|
const isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
1970
1970
|
const isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
1971
1971
|
const bundleMainProductId = flatItem.product?.product_id;
|
|
1972
|
+
// 主商品id
|
|
1973
|
+
const mainProductId = flatItem?.originProduct?._productOrigin?.id || flatItem?.parentProduct?.id || 0;
|
|
1972
1974
|
|
|
1973
1975
|
// 主商品直接可用
|
|
1974
1976
|
if (isMainProduct) {
|
|
@@ -1985,7 +1987,7 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
1985
1987
|
const priceType = flatItem.bundleItem?.price_type;
|
|
1986
1988
|
const priceTypeExt = flatItem.bundleItem?.price_type_ext;
|
|
1987
1989
|
// 主商品id
|
|
1988
|
-
const mainProductId = flatItem?.originProduct?._productOrigin?.id || flatItem?.parentProduct?.id || 0;
|
|
1990
|
+
// const mainProductId = flatItem?.originProduct?._productOrigin?.id || flatItem?.parentProduct?.id || 0;
|
|
1989
1991
|
// original_price 对应:
|
|
1990
1992
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
1991
1993
|
// markup_price 对应:
|
|
@@ -2010,13 +2012,13 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
2010
2012
|
if (!filter) {
|
|
2011
2013
|
isScopeValid = true;
|
|
2012
2014
|
} else {
|
|
2013
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
2015
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
2014
2016
|
}
|
|
2015
2017
|
}
|
|
2016
2018
|
|
|
2017
2019
|
// 包含套餐判断, products值兼容旧数据
|
|
2018
2020
|
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2019
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
2021
|
+
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
2020
2022
|
}
|
|
2021
2023
|
|
|
2022
2024
|
// 价格和套餐适用范围都符合,则可用
|
|
@@ -2078,13 +2080,13 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
2078
2080
|
if (!filter) {
|
|
2079
2081
|
isScopeValid = true;
|
|
2080
2082
|
} else {
|
|
2081
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
2083
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
2082
2084
|
}
|
|
2083
2085
|
}
|
|
2084
2086
|
|
|
2085
2087
|
// 包含套餐判断, products值兼容旧数据
|
|
2086
2088
|
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2087
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
2089
|
+
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
2088
2090
|
}
|
|
2089
2091
|
|
|
2090
2092
|
// 价格和套餐适用范围都符合,则可用
|
|
@@ -133,7 +133,9 @@ class SalesSummaryModule extends _BaseModule.BaseModule {
|
|
|
133
133
|
await this.getSurchargeList(summaryChannel);
|
|
134
134
|
}
|
|
135
135
|
const taxConfig = this.getTaxConfig();
|
|
136
|
-
const
|
|
136
|
+
const fatherModuleName = this.otherParams?.fatherModule || this.name.replace(/_salesSummary$/, '');
|
|
137
|
+
const scheduleModuleName = `${fatherModuleName}_schedule`;
|
|
138
|
+
const summarySchedule = this.core.getModule(scheduleModuleName);
|
|
137
139
|
const needScheduleIds = (this.store.surchargeList?.map(item => item.available_schedule_ids)?.flat() || []).filter(id => id !== undefined && id !== null && id !== '');
|
|
138
140
|
const scheduleList = needScheduleIds.length > 0 ? summarySchedule?.getScheduleListByIds(needScheduleIds) : [];
|
|
139
141
|
const scheduleById = {};
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -334,7 +334,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
334
334
|
* 获取当前的客户搜索条件
|
|
335
335
|
* @returns 当前搜索条件
|
|
336
336
|
*/
|
|
337
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
337
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
338
338
|
/**
|
|
339
339
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
340
340
|
* @returns 客户状态
|
|
@@ -50,11 +50,12 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
50
50
|
*/
|
|
51
51
|
private getTimelineBucketMinutes;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* 解析 current 所属营业日窗口:
|
|
54
54
|
* - 当 operating_day_boundary.type === 'start_time'
|
|
55
|
-
*
|
|
55
|
+
* 使用「最近一个 boundary.time」到「下一个 boundary.time」
|
|
56
56
|
* - 否则回退自然日(00:00 到次日 00:00)
|
|
57
57
|
*/
|
|
58
|
+
private getOperatingDayRange;
|
|
58
59
|
private getTimelineRangeByOperatingBoundary;
|
|
59
60
|
/**
|
|
60
61
|
* 统计时间轴每个时间片的预约数量。
|
|
@@ -95,7 +96,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
95
96
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
96
97
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
97
98
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
98
|
-
* - includeAllFuture
|
|
99
|
+
* - includeAllFuture 时,保留选中预约并返回当前营业日全部后续预约;仅详情接口启用。
|
|
99
100
|
*/
|
|
100
101
|
private pickBookingsForCurrentPoint;
|
|
101
102
|
/**
|
|
@@ -160,16 +160,15 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
163
|
+
* 解析 current 所属营业日窗口:
|
|
164
164
|
* - 当 operating_day_boundary.type === 'start_time'
|
|
165
|
-
*
|
|
165
|
+
* 使用「最近一个 boundary.time」到「下一个 boundary.time」
|
|
166
166
|
* - 否则回退自然日(00:00 到次日 00:00)
|
|
167
167
|
*/
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
const defaultStart = today.startOf('day');
|
|
168
|
+
getOperatingDayRange(referenceTime = (0, _dayjs.default)()) {
|
|
169
|
+
const defaultStart = referenceTime.startOf('day');
|
|
171
170
|
const defaultEndExclusive = defaultStart.add(1, 'day');
|
|
172
|
-
const appPlugin = this.core
|
|
171
|
+
const appPlugin = this.core?.getPlugin('app');
|
|
173
172
|
const coreData = appPlugin?.getApp()?.data?.store?.getStore?.().getDataByModel?.('core');
|
|
174
173
|
const operatingDayBoundary = coreData?.core?.operating_day_boundary;
|
|
175
174
|
if (operatingDayBoundary?.type !== 'start_time') {
|
|
@@ -179,18 +178,22 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
179
178
|
};
|
|
180
179
|
}
|
|
181
180
|
const boundaryTime = String(operatingDayBoundary.time || '').trim();
|
|
182
|
-
const
|
|
183
|
-
if (!
|
|
181
|
+
const boundaryStart = (0, _dayjs.default)(`${referenceTime.format('YYYY-MM-DD')} ${boundaryTime}`);
|
|
182
|
+
if (!boundaryStart.isValid()) {
|
|
184
183
|
return {
|
|
185
184
|
startAt: defaultStart,
|
|
186
185
|
endExclusiveAt: defaultEndExclusive
|
|
187
186
|
};
|
|
188
187
|
}
|
|
188
|
+
const startAt = referenceTime.isBefore(boundaryStart) ? boundaryStart.subtract(1, 'day') : boundaryStart;
|
|
189
189
|
return {
|
|
190
190
|
startAt,
|
|
191
191
|
endExclusiveAt: startAt.add(1, 'day')
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
+
getTimelineRangeByOperatingBoundary() {
|
|
195
|
+
return this.getOperatingDayRange();
|
|
196
|
+
}
|
|
194
197
|
|
|
195
198
|
/**
|
|
196
199
|
* 统计时间轴每个时间片的预约数量。
|
|
@@ -343,19 +346,21 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
343
346
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
344
347
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
345
348
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
346
|
-
* - includeAllFuture
|
|
349
|
+
* - includeAllFuture 时,保留选中预约并返回当前营业日全部后续预约;仅详情接口启用。
|
|
347
350
|
*/
|
|
348
351
|
pickBookingsForCurrentPoint(current, bookings, options = {}) {
|
|
349
352
|
if (bookings.length === 0) return [];
|
|
350
|
-
const
|
|
351
|
-
|
|
353
|
+
const {
|
|
354
|
+
startAt: operatingDayStart,
|
|
355
|
+
endExclusiveAt: operatingDayEndExclusive
|
|
356
|
+
} = this.getOperatingDayRange(current);
|
|
352
357
|
|
|
353
|
-
// 仅保留与 current
|
|
358
|
+
// 仅保留与 current 所属营业日窗口有时间交集的预约,避免跨营业日误命中
|
|
354
359
|
const dayScopedBookings = bookings.filter(booking => {
|
|
355
360
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
356
361
|
const endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
357
362
|
if (!startAt.isValid() || !endAt.isValid()) return false;
|
|
358
|
-
return
|
|
363
|
+
return startAt.isBefore(operatingDayEndExclusive) && this.isSameOrAfter(endAt, operatingDayStart);
|
|
359
364
|
});
|
|
360
365
|
if (dayScopedBookings.length === 0) return [];
|
|
361
366
|
const appendNextStartGroupIfNeeded = selectedBookings => {
|
|
@@ -404,7 +409,7 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
404
409
|
// upcoming: 从未来预约里只取最早那一组(同 start_time)
|
|
405
410
|
const upcoming = dayScopedBookings.filter(booking => {
|
|
406
411
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
407
|
-
return startAt.isValid() && startAt.isAfter(current)
|
|
412
|
+
return startAt.isValid() && startAt.isAfter(current);
|
|
408
413
|
});
|
|
409
414
|
if (upcoming.length > 0) {
|
|
410
415
|
if (options.includeAllFuture) return upcoming;
|