@pisell/pisellos 2.2.129 → 2.2.131
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/core/index.js +1 -0
- package/dist/server/index.js +10 -9
- package/dist/server/modules/order/types.d.ts +1 -0
- package/dist/server/modules/order/utils/filterOrders.js +6 -0
- package/dist/solution/Sales/index.js +7 -4
- package/lib/core/index.js +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/server/index.js +1 -0
- package/lib/server/modules/order/types.d.ts +1 -0
- package/lib/server/modules/order/utils/filterOrders.js +5 -0
- package/lib/solution/Sales/index.js +3 -0
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -2684,6 +2684,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2684
2684
|
case 0:
|
|
2685
2685
|
tTotal = performance.now();
|
|
2686
2686
|
menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime;
|
|
2687
|
+
debugger;
|
|
2687
2688
|
this.logInfo('computeProductQueryResult 开始', {
|
|
2688
2689
|
menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
|
|
2689
2690
|
schedule_datetime: schedule_datetime,
|
|
@@ -2691,7 +2692,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2691
2692
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
2692
2693
|
});
|
|
2693
2694
|
if (this.products) {
|
|
2694
|
-
_context24.next =
|
|
2695
|
+
_context24.next = 7;
|
|
2695
2696
|
break;
|
|
2696
2697
|
}
|
|
2697
2698
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
@@ -2702,9 +2703,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2702
2703
|
count: 0
|
|
2703
2704
|
}
|
|
2704
2705
|
});
|
|
2705
|
-
case
|
|
2706
|
+
case 7:
|
|
2706
2707
|
if (this.menu) {
|
|
2707
|
-
_context24.next =
|
|
2708
|
+
_context24.next = 10;
|
|
2708
2709
|
break;
|
|
2709
2710
|
}
|
|
2710
2711
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
@@ -2715,9 +2716,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2715
2716
|
count: 0
|
|
2716
2717
|
}
|
|
2717
2718
|
});
|
|
2718
|
-
case
|
|
2719
|
+
case 10:
|
|
2719
2720
|
if (this.schedule) {
|
|
2720
|
-
_context24.next =
|
|
2721
|
+
_context24.next = 13;
|
|
2721
2722
|
break;
|
|
2722
2723
|
}
|
|
2723
2724
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
@@ -2728,7 +2729,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2728
2729
|
count: 0
|
|
2729
2730
|
}
|
|
2730
2731
|
});
|
|
2731
|
-
case
|
|
2732
|
+
case 13:
|
|
2732
2733
|
activeMenuList = [];
|
|
2733
2734
|
if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
|
|
2734
2735
|
tMenu = performance.now();
|
|
@@ -2743,13 +2744,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
2743
2744
|
});
|
|
2744
2745
|
}
|
|
2745
2746
|
tPrice = performance.now();
|
|
2746
|
-
_context24.next =
|
|
2747
|
+
_context24.next = 18;
|
|
2747
2748
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
2748
2749
|
scheduleModule: this.getSchedule()
|
|
2749
2750
|
}, {
|
|
2750
2751
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
2751
2752
|
});
|
|
2752
|
-
case
|
|
2753
|
+
case 18:
|
|
2753
2754
|
allProductsWithPrice = _context24.sent;
|
|
2754
2755
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
2755
2756
|
count: allProductsWithPrice.length
|
|
@@ -2797,7 +2798,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2797
2798
|
message: '',
|
|
2798
2799
|
status: true
|
|
2799
2800
|
});
|
|
2800
|
-
case
|
|
2801
|
+
case 33:
|
|
2801
2802
|
case "end":
|
|
2802
2803
|
return _context24.stop();
|
|
2803
2804
|
}
|
|
@@ -28,6 +28,12 @@ export function filterOrders(orders, filters) {
|
|
|
28
28
|
|
|
29
29
|
// 1. 过滤
|
|
30
30
|
var filteredList = orders.filter(function (order) {
|
|
31
|
+
if (safeFilters.keyword) {
|
|
32
|
+
if (!JSON.stringify(order).toLowerCase().includes(safeFilters.keyword.toLowerCase())) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
31
37
|
// status - 订单状态
|
|
32
38
|
if (safeFilters.status && safeFilters.status.length > 0) {
|
|
33
39
|
if (!order.status || !safeFilters.status.includes(order.status)) {
|
|
@@ -267,7 +267,10 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
267
267
|
if (slotCount <= 0) return [];
|
|
268
268
|
var diff = new Int32Array(slotCount + 1);
|
|
269
269
|
for (var i = 0; i < bookingList.length; i++) {
|
|
270
|
+
var _ref2, _booking$appointment_;
|
|
270
271
|
var booking = bookingList[i];
|
|
272
|
+
var appointmentStatus = String((_ref2 = (_booking$appointment_ = booking.appointment_status) !== null && _booking$appointment_ !== void 0 ? _booking$appointment_ : booking.status) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
273
|
+
if (appointmentStatus === 'new' || appointmentStatus === 'rejected' || appointmentStatus === 'cancelled') continue;
|
|
271
274
|
var bookingStartAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
272
275
|
var bookingEndAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
273
276
|
if (!bookingStartAt.isValid() || !bookingEndAt.isValid()) continue;
|
|
@@ -336,8 +339,8 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
336
339
|
}, {
|
|
337
340
|
key: "getResourceId",
|
|
338
341
|
value: function getResourceId(resource) {
|
|
339
|
-
var
|
|
340
|
-
return (
|
|
342
|
+
var _ref3, _resource$id;
|
|
343
|
+
return (_ref3 = (_resource$id = resource.id) !== null && _resource$id !== void 0 ? _resource$id : resource.form_record_id) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
341
344
|
}
|
|
342
345
|
|
|
343
346
|
/**
|
|
@@ -454,8 +457,8 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
454
457
|
}, {
|
|
455
458
|
key: "normalizeMatchedBooking",
|
|
456
459
|
value: function normalizeMatchedBooking(current, deviceCurrent, booking) {
|
|
457
|
-
var
|
|
458
|
-
var appointmentStatus = String((
|
|
460
|
+
var _ref4, _booking$appointment_2;
|
|
461
|
+
var appointmentStatus = String((_ref4 = (_booking$appointment_2 = booking.appointment_status) !== null && _booking$appointment_2 !== void 0 ? _booking$appointment_2 : booking.status) !== null && _ref4 !== void 0 ? _ref4 : '');
|
|
459
462
|
if (appointmentStatus === 'rejected' || appointmentStatus === 'cancelled') return null;
|
|
460
463
|
var startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
461
464
|
var endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
package/lib/core/index.js
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
package/lib/server/index.js
CHANGED
|
@@ -1713,6 +1713,7 @@ var Server = class {
|
|
|
1713
1713
|
async computeProductQueryResult(context, options) {
|
|
1714
1714
|
const tTotal = performance.now();
|
|
1715
1715
|
const { menu_list_ids, schedule_date, schedule_datetime } = context;
|
|
1716
|
+
debugger;
|
|
1716
1717
|
this.logInfo("computeProductQueryResult 开始", {
|
|
1717
1718
|
menuListIdsCount: (menu_list_ids == null ? void 0 : menu_list_ids.length) ?? 0,
|
|
1718
1719
|
schedule_datetime,
|
|
@@ -35,6 +35,11 @@ function filterOrders(orders, filters) {
|
|
|
35
35
|
const size = safeFilters.num || 20;
|
|
36
36
|
const page = safeFilters.skip || 1;
|
|
37
37
|
let filteredList = orders.filter((order) => {
|
|
38
|
+
if (safeFilters.keyword) {
|
|
39
|
+
if (!JSON.stringify(order).toLowerCase().includes(safeFilters.keyword.toLowerCase())) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
38
43
|
if (safeFilters.status && safeFilters.status.length > 0) {
|
|
39
44
|
if (!order.status || !safeFilters.status.includes(order.status)) {
|
|
40
45
|
return false;
|
|
@@ -166,6 +166,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
166
166
|
const diff = new Int32Array(slotCount + 1);
|
|
167
167
|
for (let i = 0; i < bookingList.length; i++) {
|
|
168
168
|
const booking = bookingList[i];
|
|
169
|
+
const appointmentStatus = String(booking.appointment_status ?? booking.status ?? "");
|
|
170
|
+
if (appointmentStatus === "new" || appointmentStatus === "rejected" || appointmentStatus === "cancelled")
|
|
171
|
+
continue;
|
|
169
172
|
const bookingStartAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
170
173
|
const bookingEndAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
171
174
|
if (!bookingStartAt.isValid() || !bookingEndAt.isValid())
|