@pisell/pisellos 0.10.28 → 0.10.30
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.d.ts +7 -0
- package/dist/core/index.js +108 -65
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +13 -2
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Discount/index.js +4 -1
- package/dist/modules/Discount/types.d.ts +14 -4
- package/dist/modules/Order/index.d.ts +3 -1
- package/dist/modules/Order/index.js +89 -16
- package/dist/modules/Order/types.d.ts +13 -0
- package/dist/modules/Order/utils.d.ts +17 -2
- package/dist/modules/Order/utils.js +133 -27
- package/dist/modules/Quotation/index.d.ts +6 -0
- package/dist/modules/Quotation/index.js +77 -25
- package/dist/modules/ResourcePlanner/planner.js +14 -4
- package/dist/modules/ResourcePlanner/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +13 -2
- package/dist/server/index.js +1531 -1230
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +48 -23
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +419 -207
- package/dist/server/modules/order/types.d.ts +50 -0
- package/dist/server/modules/order/types.js +2 -0
- package/dist/server/modules/products/index.d.ts +10 -4
- package/dist/server/modules/products/index.js +177 -84
- package/dist/server/modules/resource/index.js +21 -13
- package/dist/server/utils/product.d.ts +1 -1
- package/dist/server/utils/product.js +186 -22
- package/dist/server/utils/small-ticket.d.ts +4 -1
- package/dist/server/utils/small-ticket.js +543 -101
- package/dist/solution/BaseSales/index.d.ts +3 -3
- package/dist/solution/BaseSales/index.js +171 -198
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/Sales/index.d.ts +7 -0
- package/dist/solution/Sales/index.js +87 -31
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +38 -21
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +20 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +12 -2
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Discount/index.js +4 -1
- package/lib/modules/Discount/types.d.ts +14 -4
- package/lib/modules/Order/index.d.ts +3 -1
- package/lib/modules/Order/index.js +69 -1
- package/lib/modules/Order/types.d.ts +13 -0
- package/lib/modules/Order/utils.d.ts +17 -2
- package/lib/modules/Order/utils.js +131 -18
- package/lib/modules/Quotation/index.d.ts +6 -0
- package/lib/modules/Quotation/index.js +52 -8
- package/lib/modules/ResourcePlanner/planner.js +9 -1
- package/lib/modules/ResourcePlanner/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +13 -2
- package/lib/server/index.js +210 -19
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +60 -7
- package/lib/server/modules/menu/index.js +26 -4
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +194 -57
- package/lib/server/modules/order/types.d.ts +50 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/server/modules/products/index.d.ts +10 -4
- package/lib/server/modules/products/index.js +93 -23
- package/lib/server/modules/resource/index.js +12 -2
- package/lib/server/utils/product.d.ts +1 -1
- package/lib/server/utils/product.js +163 -3
- package/lib/server/utils/small-ticket.d.ts +4 -1
- package/lib/server/utils/small-ticket.js +507 -75
- package/lib/solution/BaseSales/index.d.ts +3 -3
- package/lib/solution/BaseSales/index.js +9 -14
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/Sales/index.d.ts +7 -0
- package/lib/solution/Sales/index.js +48 -3
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +19 -3
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* - 不在此处发明等价关系;UI 侧(ticketBooking)若需要别的字段,由 view-model 适配层做转换
|
|
15
15
|
*/
|
|
16
16
|
import type { BaseSalesOrderProduct } from '../types';
|
|
17
|
+
import type { OrderMetaList } from '../../../modules/Order/types';
|
|
17
18
|
export interface ISalesDetailHeader {
|
|
18
19
|
order_id: number | string | null;
|
|
19
20
|
order_number?: string;
|
|
@@ -47,6 +48,7 @@ export interface ISalesDetailHeader {
|
|
|
47
48
|
schedule_date?: string;
|
|
48
49
|
created_at?: string;
|
|
49
50
|
updated_at?: string | number;
|
|
51
|
+
order_meta_list?: OrderMetaList;
|
|
50
52
|
metadata?: Record<string, any> | null;
|
|
51
53
|
total_amount?: string | number;
|
|
52
54
|
[key: string]: any;
|
|
@@ -25,7 +25,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
25
25
|
|
|
26
26
|
import { normalizeOrderCollections } from "../../../modules/Order/utils/orderCollectionIdentity";
|
|
27
27
|
/** OrderData 中除大数组外的"顶层 header 字段"白名单,按需扩展。 */
|
|
28
|
-
var HEADER_KEYS = ['order_id', 'order_number', 'shop_order_number', 'shop_full_order_number', 'type', 'business_code', 'platform', 'sales_channel', 'order_sales_channel', 'vouchers', 'status', 'payment_status', 'shipping_status', 'customer_id', 'customer_name', 'country_calling_code', 'phone', 'email', 'is_price_include_tax', 'tax_title', 'tax_country_code', 'currency_code', 'currency_symbol', 'currency_format', 'is_deposit', 'deposit_amount', 'shop_discount', 'surcharge_fee', 'note', 'schedule_date', 'created_at', 'updated_at', 'metadata', 'total_amount', 'shop_id', 'create_date', 'holder', 'relation_forms', 'contacts', 'contacts_info'];
|
|
28
|
+
var HEADER_KEYS = ['order_id', 'order_number', 'shop_order_number', 'shop_full_order_number', 'type', 'business_code', 'platform', 'sales_channel', 'order_sales_channel', 'vouchers', 'status', 'payment_status', 'shipping_status', 'customer_id', 'customer_name', 'country_calling_code', 'phone', 'email', 'is_price_include_tax', 'tax_title', 'tax_country_code', 'currency_code', 'currency_symbol', 'currency_format', 'is_deposit', 'deposit_amount', 'shop_discount', 'surcharge_fee', 'note', 'schedule_date', 'created_at', 'updated_at', 'order_meta_list', 'metadata', 'total_amount', 'shop_id', 'create_date', 'holder', 'relation_forms', 'contacts', 'contacts_info'];
|
|
29
29
|
function pickHeader(raw) {
|
|
30
30
|
var _raw$order_id;
|
|
31
31
|
var header = {
|
|
@@ -260,8 +260,9 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
260
260
|
metadata.unique_identification_number = String(uniqueIdentificationNumber);
|
|
261
261
|
}
|
|
262
262
|
// 从源头补充商品多语言标题
|
|
263
|
-
var
|
|
264
|
-
|
|
263
|
+
var productTitleI18n = (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title_i18n) || {};
|
|
264
|
+
var productTitle = _objectSpread(_objectSpread({}, productTitleI18n), {}, {
|
|
265
|
+
original: productTitleI18n.original || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.original_title) || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || ''
|
|
265
266
|
});
|
|
266
267
|
return _objectSpread(_objectSpread({
|
|
267
268
|
product_id: productId,
|
|
@@ -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 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
345
345
|
count: number;
|
|
346
346
|
left: number;
|
|
347
347
|
summaryCount: number;
|
|
348
|
-
status: "
|
|
348
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
349
349
|
}[];
|
|
350
350
|
/**
|
|
351
351
|
* 找到多个资源的公共可用时间段
|
|
@@ -105,6 +105,13 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
105
105
|
private groupBookingsByResource;
|
|
106
106
|
private isBookingMatchedResource;
|
|
107
107
|
private sortMatchedBookings;
|
|
108
|
+
/** Unpaid:与 Current 重合的订单沿用 Current 顺序,其余欠款订单按开始时间降序追加。 */
|
|
109
|
+
private sortUnpaidBookings;
|
|
110
|
+
/**
|
|
111
|
+
* 构造资源详情的 Unpaid 列表:复用旧版当前/未来订单的展示计算,再补齐被预约状态/时间漏掉的欠款订单。
|
|
112
|
+
* Unpaid 的成员资格由调用方按付款状态筛好;这里仅负责展示字段与顺序。
|
|
113
|
+
*/
|
|
114
|
+
private buildUnpaidBookings;
|
|
108
115
|
/**
|
|
109
116
|
* 资源下 bookings 的返回裁剪策略:
|
|
110
117
|
* 1) 优先返回当前时刻正在进行中的预约(允许并发返回多条)
|
|
@@ -760,6 +760,64 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
760
760
|
});
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
+
/** Unpaid:与 Current 重合的订单沿用 Current 顺序,其余欠款订单按开始时间降序追加。 */
|
|
764
|
+
}, {
|
|
765
|
+
key: "sortUnpaidBookings",
|
|
766
|
+
value: function sortUnpaidBookings(bookings, currentBookings) {
|
|
767
|
+
var _this4 = this;
|
|
768
|
+
var currentOrderIndexes = new Map(currentBookings.map(function (booking, index) {
|
|
769
|
+
return [String(booking.order.order_id), index];
|
|
770
|
+
}));
|
|
771
|
+
return _toConsumableArray(bookings).sort(function (left, right) {
|
|
772
|
+
var leftIndex = currentOrderIndexes.get(String(left.order.order_id));
|
|
773
|
+
var rightIndex = currentOrderIndexes.get(String(right.order.order_id));
|
|
774
|
+
if (leftIndex !== undefined || rightIndex !== undefined) {
|
|
775
|
+
if (leftIndex === undefined) return 1;
|
|
776
|
+
if (rightIndex === undefined) return -1;
|
|
777
|
+
return leftIndex - rightIndex;
|
|
778
|
+
}
|
|
779
|
+
var leftStartAt = _this4.toBookingDateTime(left.start_date, left.start_time).valueOf();
|
|
780
|
+
var rightStartAt = _this4.toBookingDateTime(right.start_date, right.start_time).valueOf();
|
|
781
|
+
return rightStartAt - leftStartAt;
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* 构造资源详情的 Unpaid 列表:复用旧版当前/未来订单的展示计算,再补齐被预约状态/时间漏掉的欠款订单。
|
|
787
|
+
* Unpaid 的成员资格由调用方按付款状态筛好;这里仅负责展示字段与顺序。
|
|
788
|
+
*/
|
|
789
|
+
}, {
|
|
790
|
+
key: "buildUnpaidBookings",
|
|
791
|
+
value: function buildUnpaidBookings(current, deviceCurrent, unpaidBookingList, currentBookings) {
|
|
792
|
+
var _this5 = this;
|
|
793
|
+
var legacyPrioritizedBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList), {
|
|
794
|
+
includeAllFuture: true
|
|
795
|
+
});
|
|
796
|
+
var allBookings = this.sortMatchedBookings(unpaidBookingList.map(function (booking) {
|
|
797
|
+
var normalized = _this5.normalizeMatchedBooking(current, deviceCurrent, booking, {
|
|
798
|
+
includeCompleted: true
|
|
799
|
+
});
|
|
800
|
+
if (normalized) return normalized;
|
|
801
|
+
var appointmentStatus = _this5.getBookingAppointmentStatus(booking);
|
|
802
|
+
var status = appointmentStatus === 'started' ? 'occupied' : appointmentStatus === 'completed' ? 'completed' : 'reserved';
|
|
803
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
804
|
+
status: status,
|
|
805
|
+
isTimeout: false,
|
|
806
|
+
timeoutTime: undefined,
|
|
807
|
+
progressPercent: undefined,
|
|
808
|
+
lateTime: undefined,
|
|
809
|
+
reserved_status: undefined,
|
|
810
|
+
remainingReserveTime: undefined
|
|
811
|
+
});
|
|
812
|
+
}));
|
|
813
|
+
var legacyOrderIds = new Set(legacyPrioritizedBookings.map(function (booking) {
|
|
814
|
+
return String(booking.order.order_id);
|
|
815
|
+
}));
|
|
816
|
+
return this.sortUnpaidBookings([].concat(_toConsumableArray(legacyPrioritizedBookings), _toConsumableArray(allBookings.filter(function (booking) {
|
|
817
|
+
return !legacyOrderIds.has(String(booking.order.order_id));
|
|
818
|
+
}))), currentBookings);
|
|
819
|
+
}
|
|
820
|
+
|
|
763
821
|
/**
|
|
764
822
|
* 资源下 bookings 的返回裁剪策略:
|
|
765
823
|
* 1) 优先返回当前时刻正在进行中的预约(允许并发返回多条)
|
|
@@ -771,7 +829,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
771
829
|
}, {
|
|
772
830
|
key: "pickBookingsForCurrentPoint",
|
|
773
831
|
value: function pickBookingsForCurrentPoint(current, bookings) {
|
|
774
|
-
var
|
|
832
|
+
var _this6 = this;
|
|
775
833
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
776
834
|
if (bookings.length === 0) return [];
|
|
777
835
|
var _this$getOperatingDay = this.getOperatingDayRange(current),
|
|
@@ -780,17 +838,17 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
780
838
|
|
|
781
839
|
// 仅保留与 current 所属营业日窗口有时间交集的预约,避免跨营业日误命中
|
|
782
840
|
var dayScopedBookings = bookings.filter(function (booking) {
|
|
783
|
-
var startAt =
|
|
784
|
-
var endAt =
|
|
841
|
+
var startAt = _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
842
|
+
var endAt = _this6.toBookingDateTime(booking.end_date, booking.end_time);
|
|
785
843
|
if (!startAt.isValid() || !endAt.isValid()) return false;
|
|
786
|
-
return startAt.isBefore(operatingDayEndExclusive) &&
|
|
844
|
+
return startAt.isBefore(operatingDayEndExclusive) && _this6.isSameOrAfter(endAt, operatingDayStart);
|
|
787
845
|
});
|
|
788
846
|
if (dayScopedBookings.length === 0) return [];
|
|
789
847
|
var appendNextStartGroupIfNeeded = function appendNextStartGroupIfNeeded(selectedBookings) {
|
|
790
848
|
if (selectedBookings.length === 0) return selectedBookings;
|
|
791
849
|
if (options.includeAllFuture) {
|
|
792
850
|
var allFutureBookings = dayScopedBookings.filter(function (booking) {
|
|
793
|
-
var startAt =
|
|
851
|
+
var startAt = _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
794
852
|
return startAt.isValid() && startAt.isAfter(current);
|
|
795
853
|
});
|
|
796
854
|
return [].concat(_toConsumableArray(selectedBookings), _toConsumableArray(allFutureBookings));
|
|
@@ -800,21 +858,21 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
800
858
|
});
|
|
801
859
|
if (!shouldAppendNextGroup) return selectedBookings;
|
|
802
860
|
var selectedStartValues = new Set(selectedBookings.map(function (booking) {
|
|
803
|
-
return
|
|
861
|
+
return _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
804
862
|
}).filter(function (startAt) {
|
|
805
863
|
return startAt.isValid();
|
|
806
864
|
}).map(function (startAt) {
|
|
807
865
|
return startAt.valueOf();
|
|
808
866
|
}));
|
|
809
867
|
var futureCandidates = dayScopedBookings.filter(function (booking) {
|
|
810
|
-
var startAt =
|
|
868
|
+
var startAt = _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
811
869
|
if (!startAt.isValid()) return false;
|
|
812
870
|
return startAt.isAfter(current) && !selectedStartValues.has(startAt.valueOf());
|
|
813
871
|
});
|
|
814
872
|
if (futureCandidates.length === 0) return selectedBookings;
|
|
815
|
-
var nextStartAt =
|
|
873
|
+
var nextStartAt = _this6.toBookingDateTime(futureCandidates[0].start_date, futureCandidates[0].start_time).valueOf();
|
|
816
874
|
var nextStartGroup = futureCandidates.filter(function (booking) {
|
|
817
|
-
var startAt =
|
|
875
|
+
var startAt = _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
818
876
|
return startAt.isValid() && startAt.valueOf() === nextStartAt;
|
|
819
877
|
});
|
|
820
878
|
if (nextStartGroup.length === 0) return selectedBookings;
|
|
@@ -826,10 +884,10 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
826
884
|
|
|
827
885
|
// active: current 处于 [startAt, endAt] 区间
|
|
828
886
|
var activeBookings = dayScopedBookings.filter(function (booking) {
|
|
829
|
-
var startAt =
|
|
830
|
-
var endAt =
|
|
887
|
+
var startAt = _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
888
|
+
var endAt = _this6.toBookingDateTime(booking.end_date, booking.end_time);
|
|
831
889
|
if (!startAt.isValid() || !endAt.isValid()) return false;
|
|
832
|
-
return
|
|
890
|
+
return _this6.isSameOrAfter(current, startAt) && _this6.isSameOrBefore(current, endAt);
|
|
833
891
|
});
|
|
834
892
|
if (activeBookings.length > 0) return appendNextStartGroupIfNeeded(activeBookings);
|
|
835
893
|
|
|
@@ -841,14 +899,14 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
841
899
|
|
|
842
900
|
// upcoming: 从未来预约里只取最早那一组(同 start_time)
|
|
843
901
|
var upcoming = dayScopedBookings.filter(function (booking) {
|
|
844
|
-
var startAt =
|
|
902
|
+
var startAt = _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
845
903
|
return startAt.isValid() && startAt.isAfter(current);
|
|
846
904
|
});
|
|
847
905
|
if (upcoming.length > 0) {
|
|
848
906
|
if (options.includeAllFuture) return upcoming;
|
|
849
907
|
var firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
|
|
850
908
|
var upcomingStartGroup = upcoming.filter(function (booking) {
|
|
851
|
-
var startAt =
|
|
909
|
+
var startAt = _this6.toBookingDateTime(booking.start_date, booking.start_time);
|
|
852
910
|
return startAt.valueOf() === firstStartAt;
|
|
853
911
|
});
|
|
854
912
|
return appendNextStartGroupIfNeeded(upcomingStartGroup);
|
|
@@ -901,10 +959,10 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
901
959
|
}, {
|
|
902
960
|
key: "normalizeResourceBookings",
|
|
903
961
|
value: function normalizeResourceBookings(current, deviceCurrent, bookingList) {
|
|
904
|
-
var
|
|
962
|
+
var _this7 = this;
|
|
905
963
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
906
964
|
var normalizedBookings = bookingList.map(function (booking) {
|
|
907
|
-
return
|
|
965
|
+
return _this7.normalizeMatchedBooking(current, deviceCurrent, booking, options);
|
|
908
966
|
}).filter(function (booking) {
|
|
909
967
|
return Boolean(booking);
|
|
910
968
|
}).filter(function (booking) {
|
|
@@ -1034,7 +1092,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1034
1092
|
var _getResourceBookingList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(currentTime) {
|
|
1035
1093
|
var _resourceResponse$dat,
|
|
1036
1094
|
_resourceResponse$dat2,
|
|
1037
|
-
|
|
1095
|
+
_this8 = this;
|
|
1038
1096
|
var bookingList,
|
|
1039
1097
|
deviceTime,
|
|
1040
1098
|
current,
|
|
@@ -1090,16 +1148,16 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1090
1148
|
rawBookingMap = this.groupBookingsByResource(bookingList);
|
|
1091
1149
|
bookingMap = this.groupBookingsByResource(normalizedBookings); // 输出:每个资源都返回;bookings 可能是 0 / 1 / 多条(并发场景)
|
|
1092
1150
|
list = resourceList.map(function (resource) {
|
|
1093
|
-
var resourceId =
|
|
1151
|
+
var resourceId = _this8.getResourceId(resource);
|
|
1094
1152
|
var rawMatchedBookings = rawBookingMap.get(String(resourceId)) || [];
|
|
1095
1153
|
var matchedBookings = bookingMap.get(String(resourceId)) || [];
|
|
1096
1154
|
var statsBookings = rawMatchedBookings.filter(function (booking) {
|
|
1097
|
-
return
|
|
1155
|
+
return _this8.isBookingIncludedInStats(booking);
|
|
1098
1156
|
});
|
|
1099
|
-
var orderCount =
|
|
1157
|
+
var orderCount = _this8.countBookingOrders(statsBookings);
|
|
1100
1158
|
var bookingCount = statsBookings.length;
|
|
1101
|
-
var compeleteBookingCount =
|
|
1102
|
-
var bookings =
|
|
1159
|
+
var compeleteBookingCount = _this8.countCompletedBookings(statsBookings);
|
|
1160
|
+
var bookings = _this8.pickBookingsForCurrentPoint(current, matchedBookings);
|
|
1103
1161
|
return _objectSpread(_objectSpread({}, resource), {}, {
|
|
1104
1162
|
resource_id: resourceId,
|
|
1105
1163
|
orderCount: orderCount,
|
|
@@ -1136,7 +1194,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1136
1194
|
var _getResourceBookingItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
1137
1195
|
var _resourceResponse$dat3,
|
|
1138
1196
|
_resourceResponse$dat4,
|
|
1139
|
-
|
|
1197
|
+
_this9 = this,
|
|
1140
1198
|
_params$bookingList;
|
|
1141
1199
|
var current, deviceCurrent, resourceResponse, resourceList, targetResource, resourceId, matchedBookingList, statsBookingList, completedBookingList, unpaidBookingList, bookings, completedBookings, unpaidBookings, orderCount, bookingCount, compeleteBookingCount;
|
|
1142
1200
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
@@ -1176,7 +1234,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1176
1234
|
return _context9.abrupt("return", null);
|
|
1177
1235
|
case 12:
|
|
1178
1236
|
targetResource = resourceList.find(function (resource) {
|
|
1179
|
-
return String(
|
|
1237
|
+
return String(_this9.getResourceId(resource)) === String(params.resourceId);
|
|
1180
1238
|
});
|
|
1181
1239
|
if (targetResource) {
|
|
1182
1240
|
_context9.next = 15;
|
|
@@ -1186,18 +1244,18 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1186
1244
|
case 15:
|
|
1187
1245
|
resourceId = this.getResourceId(targetResource);
|
|
1188
1246
|
matchedBookingList = params.bookingList.filter(function (booking) {
|
|
1189
|
-
return
|
|
1247
|
+
return _this9.isBookingMatchedResource(booking, resourceId);
|
|
1190
1248
|
});
|
|
1191
1249
|
statsBookingList = matchedBookingList.filter(function (booking) {
|
|
1192
|
-
return
|
|
1250
|
+
return _this9.isBookingIncludedInStats(booking);
|
|
1193
1251
|
});
|
|
1194
1252
|
completedBookingList = matchedBookingList.filter(function (booking) {
|
|
1195
|
-
return
|
|
1253
|
+
return _this9.getBookingAppointmentStatus(booking) === 'completed';
|
|
1196
1254
|
}); // const unpaidBookingList = matchedBookingList.filter(
|
|
1197
1255
|
// (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
|
|
1198
1256
|
// );
|
|
1199
1257
|
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
1200
|
-
return
|
|
1258
|
+
return _this9.isUnpaidBooking(booking);
|
|
1201
1259
|
});
|
|
1202
1260
|
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList), {
|
|
1203
1261
|
includeAllFuture: true
|
|
@@ -1213,9 +1271,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1213
1271
|
remainingReserveTime: undefined
|
|
1214
1272
|
});
|
|
1215
1273
|
});
|
|
1216
|
-
unpaidBookings = this.
|
|
1217
|
-
includeAllFuture: true
|
|
1218
|
-
});
|
|
1274
|
+
unpaidBookings = this.buildUnpaidBookings(current, deviceCurrent, unpaidBookingList, bookings);
|
|
1219
1275
|
orderCount = this.countBookingOrders(statsBookingList);
|
|
1220
1276
|
bookingCount = statsBookingList.length;
|
|
1221
1277
|
compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
@@ -123,8 +123,8 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
123
123
|
*/
|
|
124
124
|
clearSessionStorageOrderSnapshot(): void;
|
|
125
125
|
/**
|
|
126
|
-
* Kiosk
|
|
127
|
-
*
|
|
126
|
+
* H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
|
|
127
|
+
* 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
|
|
128
128
|
*/
|
|
129
129
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
130
130
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -44,7 +44,7 @@ import { UnifiedBookingSalesHooks } from "./types";
|
|
|
44
44
|
import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
45
45
|
import { BookingTicket } from "../BookingTicket";
|
|
46
46
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
47
|
-
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
47
|
+
import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
48
48
|
export * from "./types";
|
|
49
49
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
50
50
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability', 'documents'];
|
|
@@ -1098,6 +1098,7 @@ var POS_OVERRIDABLE_AVAILABILITY_CONFLICT_CODES = new Set(['past', 'booking_cuto
|
|
|
1098
1098
|
// as missing_resource at group level. Structural validation below still
|
|
1099
1099
|
// rejects a genuinely missing selection.
|
|
1100
1100
|
'missing_resource']);
|
|
1101
|
+
var POS_NO_RESOURCE_ID = 0;
|
|
1101
1102
|
function matchesForcedSelectionGroup(selection, group) {
|
|
1102
1103
|
var hasGroupId = typeof selection.requirementGroupId === 'string' && selection.requirementGroupId.trim().length > 0;
|
|
1103
1104
|
var hasFormId = selection.formId !== undefined && selection.formId !== null;
|
|
@@ -1183,7 +1184,21 @@ function buildPosForcedAvailabilityAssignments(params) {
|
|
|
1183
1184
|
return;
|
|
1184
1185
|
}
|
|
1185
1186
|
selectedResourceIds.forEach(function (resourceId) {
|
|
1186
|
-
var _group$resourceIds2, _group$
|
|
1187
|
+
var _group$resourceIds2, _group$formId2, _candidate$primarySch7, _candidate$primarySch8;
|
|
1188
|
+
if (sameAvailabilityId(resourceId, POS_NO_RESOURCE_ID)) {
|
|
1189
|
+
var _group$formId, _candidate$primarySch5, _candidate$primarySch6;
|
|
1190
|
+
assignments.push({
|
|
1191
|
+
productId: product.id,
|
|
1192
|
+
resourceId: POS_NO_RESOURCE_ID,
|
|
1193
|
+
formId: (_group$formId = group.formId) !== null && _group$formId !== void 0 ? _group$formId : selection.formId,
|
|
1194
|
+
startAt: candidate.bookingStartAt || candidate.startAt,
|
|
1195
|
+
endAt: candidate.bookingEndAt || candidate.endAt,
|
|
1196
|
+
capacityRequired: Math.max(1, partySize),
|
|
1197
|
+
scheduleId: (_candidate$primarySch5 = candidate.primaryScheduleRef) === null || _candidate$primarySch5 === void 0 ? void 0 : _candidate$primarySch5.scheduleId,
|
|
1198
|
+
timeSlotId: (_candidate$primarySch6 = candidate.primaryScheduleRef) === null || _candidate$primarySch6 === void 0 ? void 0 : _candidate$primarySch6.timeSlotId
|
|
1199
|
+
});
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1187
1202
|
var resource = resources.find(function (item) {
|
|
1188
1203
|
return sameAvailabilityId(item.id, resourceId);
|
|
1189
1204
|
});
|
|
@@ -1201,12 +1216,12 @@ function buildPosForcedAvailabilityAssignments(params) {
|
|
|
1201
1216
|
assignments.push({
|
|
1202
1217
|
productId: product.id,
|
|
1203
1218
|
resourceId: resourceId,
|
|
1204
|
-
formId: (_group$
|
|
1219
|
+
formId: (_group$formId2 = group.formId) !== null && _group$formId2 !== void 0 ? _group$formId2 : resource.formId,
|
|
1205
1220
|
startAt: candidate.bookingStartAt || candidate.startAt,
|
|
1206
1221
|
endAt: candidate.bookingEndAt || candidate.endAt,
|
|
1207
1222
|
capacityRequired: Math.max(1, partySize),
|
|
1208
|
-
scheduleId: (_candidate$
|
|
1209
|
-
timeSlotId: (_candidate$
|
|
1223
|
+
scheduleId: (_candidate$primarySch7 = candidate.primaryScheduleRef) === null || _candidate$primarySch7 === void 0 ? void 0 : _candidate$primarySch7.scheduleId,
|
|
1224
|
+
timeSlotId: (_candidate$primarySch8 = candidate.primaryScheduleRef) === null || _candidate$primarySch8 === void 0 ? void 0 : _candidate$primarySch8.timeSlotId
|
|
1210
1225
|
});
|
|
1211
1226
|
});
|
|
1212
1227
|
});
|
|
@@ -1815,15 +1830,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1815
1830
|
}
|
|
1816
1831
|
|
|
1817
1832
|
/**
|
|
1818
|
-
* Kiosk
|
|
1819
|
-
*
|
|
1833
|
+
* H5/Kiosk 不能把已收款订单留在本地等待重试,必须直接等待云端 checkout。
|
|
1834
|
+
* 其它平台保持 WebPOS/POS 的本地待同步任务;显式 true 仍可强制使用本地任务。
|
|
1820
1835
|
*/
|
|
1821
1836
|
}, {
|
|
1822
1837
|
key: "shouldUseCheckoutSyncTask",
|
|
1823
1838
|
value: function shouldUseCheckoutSyncTask() {
|
|
1824
|
-
var _this$otherParams13;
|
|
1839
|
+
var _this$otherParams13, _this$otherParams14;
|
|
1825
1840
|
var configured = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.checkoutSyncTaskEnabled;
|
|
1826
|
-
|
|
1841
|
+
if (configured === true) return true;
|
|
1842
|
+
var platform = normalizeRuntimePlatform((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform);
|
|
1843
|
+
return platform !== 'h5' && platform !== 'kiosk';
|
|
1827
1844
|
}
|
|
1828
1845
|
|
|
1829
1846
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -1977,8 +1994,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1977
1994
|
}, {
|
|
1978
1995
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
1979
1996
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
1980
|
-
var _this$
|
|
1981
|
-
return isCustomerUserPlatform((_this$
|
|
1997
|
+
var _this$otherParams15;
|
|
1998
|
+
return isCustomerUserPlatform((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform);
|
|
1982
1999
|
}
|
|
1983
2000
|
}, {
|
|
1984
2001
|
key: "resolveDiscountOrderIdentity",
|
|
@@ -2168,13 +2185,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2168
2185
|
key: "getOpenData",
|
|
2169
2186
|
value: function () {
|
|
2170
2187
|
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
2171
|
-
var _this$
|
|
2188
|
+
var _this$otherParams16, _this$otherParams17;
|
|
2172
2189
|
var businessCode, channel;
|
|
2173
2190
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
2174
2191
|
while (1) switch (_context12.prev = _context12.next) {
|
|
2175
2192
|
case 0:
|
|
2176
|
-
businessCode = String(((_this$
|
|
2177
|
-
channel = String(((_this$
|
|
2193
|
+
businessCode = String(((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.businessCode) || '').trim();
|
|
2194
|
+
channel = String(((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.channel) || '').trim();
|
|
2178
2195
|
if (!(!businessCode || !channel)) {
|
|
2179
2196
|
_context12.next = 4;
|
|
2180
2197
|
break;
|
|
@@ -2267,9 +2284,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2267
2284
|
}, {
|
|
2268
2285
|
key: "isInvoiceOpenDataCacheCurrent",
|
|
2269
2286
|
value: function isInvoiceOpenDataCacheCurrent() {
|
|
2270
|
-
var _this$
|
|
2271
|
-
var businessCode = String(((_this$
|
|
2272
|
-
var channel = String(((_this$
|
|
2287
|
+
var _this$otherParams18, _this$otherParams19;
|
|
2288
|
+
var businessCode = String(((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) || '').trim();
|
|
2289
|
+
var channel = String(((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.channel) || '').trim();
|
|
2273
2290
|
if (!businessCode || !channel) return false;
|
|
2274
2291
|
return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
|
|
2275
2292
|
}
|
|
@@ -4266,7 +4283,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4266
4283
|
value: (function () {
|
|
4267
4284
|
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(contextId) {
|
|
4268
4285
|
var _this$otherParams$pla,
|
|
4269
|
-
_this$
|
|
4286
|
+
_this$otherParams20,
|
|
4270
4287
|
_this9 = this;
|
|
4271
4288
|
var request,
|
|
4272
4289
|
_yield$this$ensureAva,
|
|
@@ -4287,7 +4304,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4287
4304
|
context = _yield$this$ensureAva.context;
|
|
4288
4305
|
projectionEntry = _yield$this$ensureAva.projectionEntry;
|
|
4289
4306
|
contextVersion = context.activeVersion;
|
|
4290
|
-
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$
|
|
4307
|
+
isPosAvailabilityRequest = String((_this$otherParams$pla = (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform) !== null && _this$otherParams$pla !== void 0 ? _this$otherParams$pla : '').trim().toLowerCase() === 'pos';
|
|
4291
4308
|
allowOutsideOperatingHoursForRequestedStartTimes = isPosAvailabilityRequest && Object.values(request.durationStartTimesByProductId || {}).some(function (startTimes) {
|
|
4292
4309
|
return Array.isArray(startTimes) && startTimes.length > 0;
|
|
4293
4310
|
});
|
|
@@ -4439,7 +4456,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4439
4456
|
key: "commitAvailabilitySelection",
|
|
4440
4457
|
value: (function () {
|
|
4441
4458
|
var _commitAvailabilitySelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(contextId, params) {
|
|
4442
|
-
var normalizedContextId, _params$bookingCount, _ref46, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla2, _this$
|
|
4459
|
+
var normalizedContextId, _params$bookingCount, _ref46, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla2, _this$otherParams21, _ref47, _params$orderProduct$3, _params$orderProduct6, _existingBooking$meta, _ref48, _ref49, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$hold, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref50, _transformed$product_4, _this$getTempOrder4, _this$getTempOrder5, _this$getTempOrder6, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, nextContext, result;
|
|
4443
4460
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4444
4461
|
while (1) switch (_context39.prev = _context39.next) {
|
|
4445
4462
|
case 0:
|
|
@@ -4669,7 +4686,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4669
4686
|
this.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
4670
4687
|
candidateDurationMinutes = getCandidateDurationMinutes(params.candidate);
|
|
4671
4688
|
candidateStartTime = getCandidateStartTime(params.candidate);
|
|
4672
|
-
allowPosAvailabilityOverride = String((_this$otherParams$pla2 = (_this$
|
|
4689
|
+
allowPosAvailabilityOverride = String((_this$otherParams$pla2 = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.platform) !== null && _this$otherParams$pla2 !== void 0 ? _this$otherParams$pla2 : '').trim().toLowerCase() === 'pos';
|
|
4673
4690
|
refreshedRanges = getProjectionProductTimeRanges(refreshedProjection, _objectSpread({
|
|
4674
4691
|
productIds: [params.candidate.productId],
|
|
4675
4692
|
dateRange: {
|
package/lib/core/index.d.ts
CHANGED
|
@@ -12,8 +12,15 @@ declare class PisellOSCore implements PisellCore {
|
|
|
12
12
|
context: BusinessContext;
|
|
13
13
|
server: any;
|
|
14
14
|
serverOptions?: ServerOptions;
|
|
15
|
+
private serverModulePromise?;
|
|
15
16
|
constructor(options?: PisellOSOptions);
|
|
16
17
|
private initialize;
|
|
18
|
+
/**
|
|
19
|
+
* 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
|
|
20
|
+
* 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
|
|
21
|
+
*/
|
|
22
|
+
preloadServerModule(): Promise<void>;
|
|
23
|
+
private loadServerModule;
|
|
17
24
|
/**
|
|
18
25
|
* 初始化 Server(公开方法,需要外部显式调用并等待)
|
|
19
26
|
* Server 配置从构造函数传入的 options.server 中获取
|
package/lib/core/index.js
CHANGED
|
@@ -20,7 +20,7 @@ class PisellOSCore {
|
|
|
20
20
|
context = {};
|
|
21
21
|
server; // Server 实例
|
|
22
22
|
serverOptions; // 保存 Server 配置
|
|
23
|
-
|
|
23
|
+
serverModulePromise;
|
|
24
24
|
constructor(options) {
|
|
25
25
|
this.debug = options?.debug || false;
|
|
26
26
|
this.context = options?.context || {};
|
|
@@ -45,6 +45,24 @@ class PisellOSCore {
|
|
|
45
45
|
this.log('[PisellOS] 核心初始化完成');
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
|
|
50
|
+
* 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
|
|
51
|
+
*/
|
|
52
|
+
async preloadServerModule() {
|
|
53
|
+
if (this.server || !this.serverOptions) return;
|
|
54
|
+
await this.loadServerModule();
|
|
55
|
+
}
|
|
56
|
+
loadServerModule() {
|
|
57
|
+
if (!this.serverModulePromise) {
|
|
58
|
+
this.serverModulePromise = Promise.resolve().then(() => _interopRequireWildcard(require("../server"))).catch(error => {
|
|
59
|
+
this.serverModulePromise = undefined;
|
|
60
|
+
throw error;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return this.serverModulePromise;
|
|
64
|
+
}
|
|
65
|
+
|
|
48
66
|
/**
|
|
49
67
|
* 初始化 Server(公开方法,需要外部显式调用并等待)
|
|
50
68
|
* Server 配置从构造函数传入的 options.server 中获取
|
|
@@ -63,7 +81,7 @@ class PisellOSCore {
|
|
|
63
81
|
}
|
|
64
82
|
try {
|
|
65
83
|
// 动态导入 Server 类以避免循环依赖
|
|
66
|
-
const ServerModule = await
|
|
84
|
+
const ServerModule = await this.loadServerModule();
|
|
67
85
|
const Server = ServerModule.default;
|
|
68
86
|
|
|
69
87
|
// 创建 Server 实例
|
|
@@ -364,15 +364,25 @@ class DataVariantEvaluator {
|
|
|
364
364
|
if (!appliedInfo?.appliedFields?.length) {
|
|
365
365
|
return originalItem;
|
|
366
366
|
}
|
|
367
|
+
|
|
368
|
+
// 套餐加价/减价使用配置价;仅商品原价模式跟随子商品的 Data Variant 价格。
|
|
369
|
+
const isOriginalPriceBundleItem = originalItem.price_type === 'markup' && originalItem.price_type_ext === 'product_price';
|
|
370
|
+
const appliedFields = appliedInfo.appliedFields.filter(field => field !== 'price' || isOriginalPriceBundleItem);
|
|
371
|
+
if (!appliedFields.length) {
|
|
372
|
+
return originalItem;
|
|
373
|
+
}
|
|
367
374
|
const result = {
|
|
368
375
|
...originalItem
|
|
369
376
|
};
|
|
370
|
-
for (const field of
|
|
377
|
+
for (const field of appliedFields) {
|
|
371
378
|
if (resolvedItem[field] !== undefined) {
|
|
372
379
|
result[field] = resolvedItem[field];
|
|
373
380
|
}
|
|
374
381
|
}
|
|
375
|
-
result._dataVariant =
|
|
382
|
+
result._dataVariant = {
|
|
383
|
+
...appliedInfo,
|
|
384
|
+
appliedFields
|
|
385
|
+
};
|
|
376
386
|
return result;
|
|
377
387
|
}
|
|
378
388
|
evaluateProductRules(rule, product, businessData, menuScopeMap) {
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
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; }
|