@pisell/pisellos 0.0.493 → 0.0.495
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Order/index.d.ts +5 -0
- package/dist/modules/Order/index.js +70 -5
- package/dist/modules/Order/utils.js +12 -2
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Quotation/index.d.ts +8 -0
- package/dist/modules/Quotation/index.js +46 -13
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/utils.js +22 -3
- package/dist/solution/VenueBooking/index.d.ts +8 -9
- package/dist/solution/VenueBooking/index.js +614 -567
- package/dist/solution/VenueBooking/types.d.ts +7 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +13 -2
- package/dist/solution/VenueBooking/utils/slotMerge.js +92 -15
- package/lib/modules/Cart/utils/cartProduct.js +1 -0
- package/lib/modules/Order/index.d.ts +5 -0
- package/lib/modules/Order/index.js +37 -1
- package/lib/modules/Order/utils.js +13 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Quotation/index.d.ts +8 -0
- package/lib/modules/Quotation/index.js +27 -6
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/utils.js +20 -3
- package/lib/solution/VenueBooking/index.d.ts +8 -9
- package/lib/solution/VenueBooking/index.js +82 -71
- package/lib/solution/VenueBooking/types.d.ts +7 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +13 -2
- package/lib/solution/VenueBooking/utils/slotMerge.js +67 -13
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -382,6 +382,7 @@ export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
|
|
|
382
382
|
option: formatOptionsToOrigin(getBundleValueByKey('option')),
|
|
383
383
|
discount_list: d.discount_list,
|
|
384
384
|
"bundle_selling_price": d === null || d === void 0 ? void 0 : d.price,
|
|
385
|
+
"custom_price": d === null || d === void 0 ? void 0 : d.price,
|
|
385
386
|
metadata: {
|
|
386
387
|
custom_product_bundle_map_id: d._id,
|
|
387
388
|
product_discount_difference: product_discount_difference
|
|
@@ -15,6 +15,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
15
15
|
private cacheId;
|
|
16
16
|
private salesSummaryModuleName;
|
|
17
17
|
private rulesHooksOverride?;
|
|
18
|
+
/**
|
|
19
|
+
* Populate `savedAmount` on each discount based on product-level discount details.
|
|
20
|
+
* Only selected discounts get a non-zero value.
|
|
21
|
+
*/
|
|
22
|
+
static populateSavedAmounts(productList: Array<Record<string, any>>, discountList: Array<Record<string, any>>): void;
|
|
18
23
|
constructor(name?: string, version?: string);
|
|
19
24
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
20
25
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
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); }
|
|
2
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
5
|
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); }
|
|
@@ -185,7 +186,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
185
186
|
original_price: values.original_price !== undefined ? String(values.original_price) : product.original_price,
|
|
186
187
|
discount_list: (_values$discount_list = values.discount_list) !== null && _values$discount_list !== void 0 ? _values$discount_list : product.discount_list,
|
|
187
188
|
num: (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num,
|
|
188
|
-
product_bundle: (_values$bundle = values.bundle) !== null && _values$bundle !== void 0 ? _values$bundle : product.product_bundle
|
|
189
|
+
product_bundle: (_values$bundle = values.bundle) !== null && _values$bundle !== void 0 ? _values$bundle : product.product_bundle,
|
|
190
|
+
metadata: _objectSpread(_objectSpread({}, product.metadata || {}), values.main_product_selling_price !== undefined ? {
|
|
191
|
+
main_product_selling_price: String(values.main_product_selling_price)
|
|
192
|
+
} : {})
|
|
189
193
|
});
|
|
190
194
|
}
|
|
191
195
|
};
|
|
@@ -361,6 +365,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
361
365
|
}
|
|
362
366
|
if (result !== null && result !== void 0 && result.discountList) {
|
|
363
367
|
var _this$store$discount7;
|
|
368
|
+
OrderModule.populateSavedAmounts(result.productList || tempOrder.products, result.discountList);
|
|
364
369
|
(_this$store$discount7 = this.store.discount) === null || _this$store$discount7 === void 0 || _this$store$discount7.setDiscountList(result.discountList);
|
|
365
370
|
tempOrder.discount_list = result.discountList.filter(function (d) {
|
|
366
371
|
return d.isSelected;
|
|
@@ -671,23 +676,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
671
676
|
key: "removeProductFromOrder",
|
|
672
677
|
value: function () {
|
|
673
678
|
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(identity) {
|
|
674
|
-
var tempOrder;
|
|
679
|
+
var tempOrder, beforeProducts, removedByStrictIdentity;
|
|
675
680
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
676
681
|
while (1) switch (_context9.prev = _context9.next) {
|
|
677
682
|
case 0:
|
|
678
683
|
tempOrder = this.ensureTempOrder();
|
|
684
|
+
beforeProducts = tempOrder.products;
|
|
679
685
|
tempOrder.products = tempOrder.products.filter(function (item) {
|
|
680
686
|
return !isIdentityMatch(item, identity);
|
|
681
687
|
});
|
|
688
|
+
removedByStrictIdentity = beforeProducts.length - tempOrder.products.length;
|
|
689
|
+
if (removedByStrictIdentity === 0 && identity.identity_key) {
|
|
690
|
+
tempOrder.products = tempOrder.products.filter(function (item) {
|
|
691
|
+
var isSameProduct = String(item.product_id) === String(identity.product_id) && String(item.product_variant_id) === String(identity.product_variant_id);
|
|
692
|
+
var hasNoIdentityKey = !item.identity_key;
|
|
693
|
+
return !(isSameProduct && hasNoIdentityKey);
|
|
694
|
+
});
|
|
695
|
+
}
|
|
682
696
|
this.applyDiscount();
|
|
683
|
-
_context9.next =
|
|
697
|
+
_context9.next = 8;
|
|
684
698
|
return this.recalculateSummary({
|
|
685
699
|
createIfMissing: true
|
|
686
700
|
});
|
|
687
|
-
case
|
|
701
|
+
case 8:
|
|
688
702
|
this.persistTempOrder();
|
|
689
703
|
return _context9.abrupt("return", tempOrder.products);
|
|
690
|
-
case
|
|
704
|
+
case 10:
|
|
691
705
|
case "end":
|
|
692
706
|
return _context9.stop();
|
|
693
707
|
}
|
|
@@ -1072,6 +1086,57 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1072
1086
|
}
|
|
1073
1087
|
return scanOrderMore;
|
|
1074
1088
|
}()
|
|
1089
|
+
}], [{
|
|
1090
|
+
key: "populateSavedAmounts",
|
|
1091
|
+
value:
|
|
1092
|
+
/**
|
|
1093
|
+
* Populate `savedAmount` on each discount based on product-level discount details.
|
|
1094
|
+
* Only selected discounts get a non-zero value.
|
|
1095
|
+
*/
|
|
1096
|
+
function populateSavedAmounts(productList, discountList) {
|
|
1097
|
+
var savedMap = new Map();
|
|
1098
|
+
var _iterator = _createForOfIteratorHelper(productList),
|
|
1099
|
+
_step;
|
|
1100
|
+
try {
|
|
1101
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1102
|
+
var product = _step.value;
|
|
1103
|
+
var qty = product.num || 1;
|
|
1104
|
+
var _iterator3 = _createForOfIteratorHelper(product.discount_list || []),
|
|
1105
|
+
_step3;
|
|
1106
|
+
try {
|
|
1107
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1108
|
+
var _pd$discount, _pd$metadata;
|
|
1109
|
+
var pd = _step3.value;
|
|
1110
|
+
var discountKey = ((_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) || pd.id;
|
|
1111
|
+
if (discountKey == null) continue;
|
|
1112
|
+
var amount = new Decimal(pd.amount || 0).times(qty).plus(((_pd$metadata = pd.metadata) === null || _pd$metadata === void 0 ? void 0 : _pd$metadata.product_discount_difference) || 0);
|
|
1113
|
+
savedMap.set(discountKey, (savedMap.get(discountKey) || new Decimal(0)).plus(amount));
|
|
1114
|
+
}
|
|
1115
|
+
} catch (err) {
|
|
1116
|
+
_iterator3.e(err);
|
|
1117
|
+
} finally {
|
|
1118
|
+
_iterator3.f();
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
} catch (err) {
|
|
1122
|
+
_iterator.e(err);
|
|
1123
|
+
} finally {
|
|
1124
|
+
_iterator.f();
|
|
1125
|
+
}
|
|
1126
|
+
var _iterator2 = _createForOfIteratorHelper(discountList),
|
|
1127
|
+
_step2;
|
|
1128
|
+
try {
|
|
1129
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1130
|
+
var d = _step2.value;
|
|
1131
|
+
var key = d.id;
|
|
1132
|
+
d.savedAmount = d.isSelected && key != null && savedMap.has(key) ? savedMap.get(key).toNumber() : 0;
|
|
1133
|
+
}
|
|
1134
|
+
} catch (err) {
|
|
1135
|
+
_iterator2.e(err);
|
|
1136
|
+
} finally {
|
|
1137
|
+
_iterator2.f();
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1075
1140
|
}]);
|
|
1076
1141
|
return OrderModule;
|
|
1077
1142
|
}(BaseModule);
|
|
@@ -114,6 +114,16 @@ function normalizeSubmitProduct(product) {
|
|
|
114
114
|
if (rawMetadata.unique_identification_number) {
|
|
115
115
|
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
116
116
|
}
|
|
117
|
+
var priceMetaKeys = ['main_product_original_price', 'main_product_selling_price', 'source_product_price'];
|
|
118
|
+
for (var _i = 0, _priceMetaKeys = priceMetaKeys; _i < _priceMetaKeys.length; _i++) {
|
|
119
|
+
var key = _priceMetaKeys[_i];
|
|
120
|
+
if (rawMetadata[key] !== undefined) {
|
|
121
|
+
cleanMetadata[key] = rawMetadata[key];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (rawMetadata.price_breakdown) {
|
|
125
|
+
cleanMetadata.price_breakdown = rawMetadata.price_breakdown;
|
|
126
|
+
}
|
|
117
127
|
return _objectSpread(_objectSpread(_objectSpread({}, submitProduct), bookingUid ? {
|
|
118
128
|
booking_uid: bookingUid
|
|
119
129
|
} : {}), {}, {
|
|
@@ -128,8 +138,8 @@ function resolveTableOccupancyDuration(tempOrder) {
|
|
|
128
138
|
var _metadata$table_confi, _metadata$tableConfig, _metadata$resource_co, _metadata$resourceCon;
|
|
129
139
|
var metadata = tempOrder.metadata || {};
|
|
130
140
|
var candidates = [metadata.table_occupancy_duration, metadata.booking_duration, metadata.table_duration, metadata.duration, (_metadata$table_confi = metadata.table_config) === null || _metadata$table_confi === void 0 ? void 0 : _metadata$table_confi.occupancy_duration, (_metadata$tableConfig = metadata.tableConfig) === null || _metadata$tableConfig === void 0 ? void 0 : _metadata$tableConfig.occupancy_duration, (_metadata$resource_co = metadata.resource_config) === null || _metadata$resource_co === void 0 ? void 0 : _metadata$resource_co.occupancy_duration, (_metadata$resourceCon = metadata.resourceConfig) === null || _metadata$resourceCon === void 0 ? void 0 : _metadata$resourceCon.occupancy_duration];
|
|
131
|
-
for (var
|
|
132
|
-
var value = _candidates[
|
|
141
|
+
for (var _i2 = 0, _candidates = candidates; _i2 < _candidates.length; _i2++) {
|
|
142
|
+
var value = _candidates[_i2];
|
|
133
143
|
var duration = Number(value);
|
|
134
144
|
if (Number.isFinite(duration) && duration > 0) {
|
|
135
145
|
return Math.floor(duration);
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import type { ScheduleItem } from '../Schedule/types';
|
|
3
4
|
import type { QuotationItem } from './types';
|
|
4
5
|
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState } from './types';
|
|
5
6
|
export declare class QuotationModule extends BaseModule implements Module {
|
|
@@ -7,6 +8,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
7
8
|
protected defaultVersion: string;
|
|
8
9
|
private request;
|
|
9
10
|
private store;
|
|
11
|
+
private scheduleResolver?;
|
|
10
12
|
constructor(name?: string, version?: string);
|
|
11
13
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
12
14
|
loadQuotations(params?: {
|
|
@@ -26,6 +28,11 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
26
28
|
variantId?: number;
|
|
27
29
|
datetime: string;
|
|
28
30
|
}): string | null;
|
|
31
|
+
getQuotationShelfId(params: {
|
|
32
|
+
productId: number;
|
|
33
|
+
variantId?: number;
|
|
34
|
+
datetime: string;
|
|
35
|
+
}): number;
|
|
29
36
|
/**
|
|
30
37
|
* Batch pre-compute quotation prices for a set of products across multiple time points.
|
|
31
38
|
* Key format: `${productId}:${timePoint}`
|
|
@@ -35,6 +42,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
35
42
|
productIds: number[];
|
|
36
43
|
timePoints: string[];
|
|
37
44
|
}): Map<string, string | null>;
|
|
45
|
+
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
38
46
|
private isQuotationActiveAt;
|
|
39
47
|
private findProductData;
|
|
40
48
|
}
|
|
@@ -35,6 +35,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
35
35
|
_defineProperty(_assertThisInitialized(_this), "store", {
|
|
36
36
|
list: []
|
|
37
37
|
});
|
|
38
|
+
_defineProperty(_assertThisInitialized(_this), "scheduleResolver", void 0);
|
|
38
39
|
return _this;
|
|
39
40
|
}
|
|
40
41
|
_createClass(QuotationModule, [{
|
|
@@ -137,6 +138,29 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
137
138
|
}
|
|
138
139
|
return null;
|
|
139
140
|
}
|
|
141
|
+
}, {
|
|
142
|
+
key: "getQuotationShelfId",
|
|
143
|
+
value: function getQuotationShelfId(params) {
|
|
144
|
+
var productId = params.productId,
|
|
145
|
+
variantId = params.variantId,
|
|
146
|
+
datetime = params.datetime;
|
|
147
|
+
var _iterator2 = _createForOfIteratorHelper(this.store.list),
|
|
148
|
+
_step2;
|
|
149
|
+
try {
|
|
150
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
151
|
+
var quotation = _step2.value;
|
|
152
|
+
if (!this.isQuotationActiveAt(quotation, datetime)) continue;
|
|
153
|
+
var match = this.findProductData(quotation.product_data, productId, variantId);
|
|
154
|
+
if (!match || match.value === 0) continue;
|
|
155
|
+
return quotation.id;
|
|
156
|
+
}
|
|
157
|
+
} catch (err) {
|
|
158
|
+
_iterator2.e(err);
|
|
159
|
+
} finally {
|
|
160
|
+
_iterator2.f();
|
|
161
|
+
}
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
140
164
|
|
|
141
165
|
/**
|
|
142
166
|
* Batch pre-compute quotation prices for a set of products across multiple time points.
|
|
@@ -148,16 +172,16 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
148
172
|
value: function buildProductPriceMap(params) {
|
|
149
173
|
var map = new Map();
|
|
150
174
|
if (!this.store.list.length) return map;
|
|
151
|
-
var
|
|
152
|
-
|
|
175
|
+
var _iterator3 = _createForOfIteratorHelper(params.productIds),
|
|
176
|
+
_step3;
|
|
153
177
|
try {
|
|
154
|
-
for (
|
|
155
|
-
var productId =
|
|
156
|
-
var
|
|
157
|
-
|
|
178
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
179
|
+
var productId = _step3.value;
|
|
180
|
+
var _iterator4 = _createForOfIteratorHelper(params.timePoints),
|
|
181
|
+
_step4;
|
|
158
182
|
try {
|
|
159
|
-
for (
|
|
160
|
-
var timePoint =
|
|
183
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
184
|
+
var timePoint = _step4.value;
|
|
161
185
|
var key = "".concat(productId, ":").concat(timePoint);
|
|
162
186
|
var price = this.getPriceForProduct({
|
|
163
187
|
productId: productId,
|
|
@@ -168,24 +192,33 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
192
|
}
|
|
169
193
|
}
|
|
170
194
|
} catch (err) {
|
|
171
|
-
|
|
195
|
+
_iterator4.e(err);
|
|
172
196
|
} finally {
|
|
173
|
-
|
|
197
|
+
_iterator4.f();
|
|
174
198
|
}
|
|
175
199
|
}
|
|
176
200
|
} catch (err) {
|
|
177
|
-
|
|
201
|
+
_iterator3.e(err);
|
|
178
202
|
} finally {
|
|
179
|
-
|
|
203
|
+
_iterator3.f();
|
|
180
204
|
}
|
|
181
205
|
return map;
|
|
182
206
|
}
|
|
207
|
+
}, {
|
|
208
|
+
key: "setScheduleResolver",
|
|
209
|
+
value: function setScheduleResolver(resolver) {
|
|
210
|
+
this.scheduleResolver = resolver;
|
|
211
|
+
}
|
|
183
212
|
}, {
|
|
184
213
|
key: "isQuotationActiveAt",
|
|
185
214
|
value: function isQuotationActiveAt(quotation, datetime) {
|
|
186
|
-
var _quotation$schedule
|
|
215
|
+
var _quotation$schedule,
|
|
216
|
+
_this2 = this;
|
|
187
217
|
if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
|
|
188
218
|
var scheduleItems = quotation.schedule.map(function (s) {
|
|
219
|
+
var _this2$scheduleResolv;
|
|
220
|
+
var full = (_this2$scheduleResolv = _this2.scheduleResolver) === null || _this2$scheduleResolv === void 0 ? void 0 : _this2$scheduleResolv.call(_this2, s.id);
|
|
221
|
+
if (full) return full;
|
|
189
222
|
return _objectSpread(_objectSpread({}, s), {}, {
|
|
190
223
|
repeat_type: s.repeat_type || 'none',
|
|
191
224
|
repeat_rule: s.repeat_rule || null,
|
|
@@ -60,8 +60,8 @@ var isInStandardSchedule = function isInStandardSchedule(targetDate, targetDateS
|
|
|
60
60
|
var startDate = dayjs(schedule.start_time);
|
|
61
61
|
var endDate = dayjs(schedule.end_time);
|
|
62
62
|
|
|
63
|
-
//
|
|
64
|
-
var isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.
|
|
63
|
+
// 先检查是否在基础时间范围内(不考虑重复),end 为开区间
|
|
64
|
+
var isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate);
|
|
65
65
|
if (schedule.repeat_type === 'none') {
|
|
66
66
|
return isInBasicRange;
|
|
67
67
|
}
|
|
@@ -75,24 +75,18 @@ var isInTimeSlotsSchedule = function isInTimeSlotsSchedule(targetDate, targetDat
|
|
|
75
75
|
if (!schedule.start_time) {
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
// 检查日期是否匹配
|
|
81
|
-
if (targetDateString !== scheduleDate) {
|
|
78
|
+
var scheduleStartDate = dayjs(schedule.start_time.split(' ')[0]);
|
|
79
|
+
if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
|
|
82
80
|
return false;
|
|
83
81
|
}
|
|
84
|
-
|
|
85
|
-
// 检查是否在任一时间段内
|
|
86
82
|
var _iterator2 = _createForOfIteratorHelper(schedule.time_slot),
|
|
87
83
|
_step2;
|
|
88
84
|
try {
|
|
89
85
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
90
86
|
var timeSlot = _step2.value;
|
|
91
|
-
var slotStart = "".concat(
|
|
92
|
-
var slotEnd = "".concat(
|
|
93
|
-
|
|
94
|
-
var slotEndDate = dayjs(slotEnd);
|
|
95
|
-
if (targetDate.isSameOrAfter(slotStartDate) && targetDate.isSameOrBefore(slotEndDate)) {
|
|
87
|
+
var slotStart = dayjs("".concat(targetDateString, " ").concat(timeSlot.start_time, ":00"));
|
|
88
|
+
var slotEnd = dayjs("".concat(targetDateString, " ").concat(timeSlot.end_time, ":00"));
|
|
89
|
+
if (targetDate.isSameOrAfter(slotStart) && targetDate.isBefore(slotEnd)) {
|
|
96
90
|
return true;
|
|
97
91
|
}
|
|
98
92
|
}
|
|
@@ -120,7 +114,7 @@ var isInDesignationSchedule = function isInDesignationSchedule(targetDate, targe
|
|
|
120
114
|
var endDateTime = "".concat(designation.end_date, " ").concat(designation.end_time, ":00");
|
|
121
115
|
var startDate = dayjs(startDateTime);
|
|
122
116
|
var endDate = dayjs(endDateTime);
|
|
123
|
-
if (targetDate.isSameOrAfter(startDate) && targetDate.
|
|
117
|
+
if (targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate)) {
|
|
124
118
|
return true;
|
|
125
119
|
}
|
|
126
120
|
}
|
|
@@ -218,9 +212,8 @@ var isInDailyRepeat = function isInDailyRepeat(targetDate, startDate, endDate, r
|
|
|
218
212
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
219
213
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
220
214
|
|
|
221
|
-
// 每日重复:每天都在相同的时间段内有效
|
|
222
|
-
|
|
223
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
215
|
+
// 每日重复:每天都在相同的时间段内有效 [start, end)
|
|
216
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay < endTimeOfDay;
|
|
224
217
|
};
|
|
225
218
|
|
|
226
219
|
// 每周重复逻辑
|
|
@@ -247,7 +240,7 @@ var isInWeeklyRepeat = function isInWeeklyRepeat(targetDate, startDate, endDate,
|
|
|
247
240
|
var targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
248
241
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
249
242
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
250
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
243
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay < endTimeOfDay;
|
|
251
244
|
};
|
|
252
245
|
|
|
253
246
|
// 日程时间段类型
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
358
358
|
};
|
|
359
359
|
setOtherData(key: string, value: any): void;
|
|
360
360
|
getOtherData(key: string): any;
|
|
361
|
-
getProductTypeById(id: number): Promise<"
|
|
361
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
362
362
|
/**
|
|
363
363
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
364
364
|
*
|
|
@@ -358,6 +358,25 @@ export function normalizeOrderProduct(product) {
|
|
|
358
358
|
if (product.identity_key && !metadata.unique_identification_number) {
|
|
359
359
|
metadata.unique_identification_number = product.identity_key;
|
|
360
360
|
}
|
|
361
|
+
var resolvedOriginalPrice = product.original_price || '0.00';
|
|
362
|
+
var resolvedSellingPrice = product.selling_price || '0.00';
|
|
363
|
+
if (metadata.main_product_original_price === undefined) {
|
|
364
|
+
metadata.main_product_original_price = resolvedOriginalPrice;
|
|
365
|
+
}
|
|
366
|
+
if (metadata.main_product_selling_price === undefined) {
|
|
367
|
+
metadata.main_product_selling_price = resolvedSellingPrice;
|
|
368
|
+
}
|
|
369
|
+
if (metadata.source_product_price === undefined) {
|
|
370
|
+
var _product$_origin$orig, _product$_origin;
|
|
371
|
+
metadata.source_product_price = (_product$_origin$orig = (_product$_origin = product._origin) === null || _product$_origin === void 0 ? void 0 : _product$_origin.original_price) !== null && _product$_origin$orig !== void 0 ? _product$_origin$orig : resolvedOriginalPrice;
|
|
372
|
+
}
|
|
373
|
+
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
374
|
+
var _ref, _item$bundle_selling_, _ref2, _ref3, _item$custom_price;
|
|
375
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
376
|
+
bundle_selling_price: (_ref = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref !== void 0 ? _ref : '0.00',
|
|
377
|
+
custom_price: (_ref2 = (_ref3 = (_item$custom_price = item.custom_price) !== null && _item$custom_price !== void 0 ? _item$custom_price : item.bundle_selling_price) !== null && _ref3 !== void 0 ? _ref3 : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00'
|
|
378
|
+
});
|
|
379
|
+
});
|
|
361
380
|
return {
|
|
362
381
|
order_detail_id: product.order_detail_id || null,
|
|
363
382
|
product_id: product.product_id,
|
|
@@ -365,13 +384,13 @@ export function normalizeOrderProduct(product) {
|
|
|
365
384
|
product_variant_id: product.product_variant_id,
|
|
366
385
|
identity_key: product.identity_key,
|
|
367
386
|
product_option_item: product.product_option_item || [],
|
|
368
|
-
selling_price:
|
|
369
|
-
original_price:
|
|
387
|
+
selling_price: resolvedSellingPrice,
|
|
388
|
+
original_price: resolvedOriginalPrice,
|
|
370
389
|
payment_price: product.payment_price || '0.00',
|
|
371
390
|
tax_fee: product.tax_fee || '0.00',
|
|
372
391
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
373
392
|
discount_list: product.discount_list || [],
|
|
374
|
-
product_bundle:
|
|
393
|
+
product_bundle: normalizedBundle,
|
|
375
394
|
metadata: metadata,
|
|
376
395
|
_origin: product._origin
|
|
377
396
|
};
|
|
@@ -60,14 +60,12 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
60
60
|
passed: boolean | null;
|
|
61
61
|
failures: QuantityCheckResult[];
|
|
62
62
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
collectionIds?: number[];
|
|
70
|
-
}): Promise<ProductData[]>;
|
|
63
|
+
loadAllProducts(): Promise<{
|
|
64
|
+
venueProducts: ProductData[];
|
|
65
|
+
addonProducts: ProductData[];
|
|
66
|
+
}>;
|
|
67
|
+
loadVenueProducts(): Promise<ProductData[]>;
|
|
68
|
+
loadAddonProducts(): Promise<ProductData[]>;
|
|
71
69
|
getVenueProducts(): ProductData[];
|
|
72
70
|
getAddonProductsList(): ProductData[];
|
|
73
71
|
loadQuotations(params?: {
|
|
@@ -107,6 +105,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
107
105
|
setSlotConfig(config: Partial<VenueBookingSlotConfig>): void;
|
|
108
106
|
getSlotConfig(): VenueBookingSlotConfig;
|
|
109
107
|
loadSchedules(): Promise<void>;
|
|
108
|
+
private injectScheduleResolverToQuotation;
|
|
110
109
|
getScheduleListByIds(ids: number[]): import("../../server").ScheduleItem[];
|
|
111
110
|
getTempOrder(): import("./types").ScanOrderTempOrder | null;
|
|
112
111
|
updateTempOrderNote(note: string): string;
|
|
@@ -140,7 +139,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
140
139
|
updates: Partial<ScanOrderOrderProduct>;
|
|
141
140
|
}): Promise<ScanOrderOrderProduct[]>;
|
|
142
141
|
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
143
|
-
getProductList(): Promise<
|
|
142
|
+
getProductList(): Promise<ProductData[]>;
|
|
144
143
|
private loadOpenDataConfig;
|
|
145
144
|
private loadRuntimeConfigs;
|
|
146
145
|
private fetchItemRuleConfigsByModelIds;
|