@pisell/pisellos 2.1.179 → 2.1.183
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.
|
@@ -136,8 +136,8 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
136
136
|
key: "loadScheduleAvailableDate",
|
|
137
137
|
value: function () {
|
|
138
138
|
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
139
|
-
var _res$data$
|
|
140
|
-
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
139
|
+
var _res$data, _res$data2, _res$data3, _res$data4, _res$data5;
|
|
140
|
+
var startDate, endDate, custom_page_id, channel, dates, res, _res$data6;
|
|
141
141
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
142
142
|
while (1) switch (_context3.prev = _context3.next) {
|
|
143
143
|
case 0:
|
|
@@ -165,22 +165,22 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
165
|
});
|
|
166
166
|
case 8:
|
|
167
167
|
res = _context3.sent;
|
|
168
|
-
this.setAvailabilityScheduleDateList(res.data.date_list);
|
|
169
|
-
this.setOtherProductsIds(res.data.other_product_ids || []);
|
|
168
|
+
this.setAvailabilityScheduleDateList(((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.date_list) || []);
|
|
169
|
+
this.setOtherProductsIds(((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.other_product_ids) || []);
|
|
170
170
|
// 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
|
|
171
|
-
if (!(!((_res$
|
|
171
|
+
if (!(!((_res$data3 = res.data) !== null && _res$data3 !== void 0 && (_res$data3 = _res$data3.date_list) !== null && _res$data3 !== void 0 && _res$data3.length) && !((_res$data4 = res.data) !== null && _res$data4 !== void 0 && (_res$data4 = _res$data4.other_product_ids) !== null && _res$data4 !== void 0 && _res$data4.length) || dayjs(endDate).isBefore(dayjs(), 'day'))) {
|
|
172
172
|
_context3.next = 13;
|
|
173
173
|
break;
|
|
174
174
|
}
|
|
175
175
|
return _context3.abrupt("return", dates);
|
|
176
176
|
case 13:
|
|
177
|
-
if ((_res$
|
|
177
|
+
if ((_res$data5 = res.data) !== null && _res$data5 !== void 0 && (_res$data5 = _res$data5.other_product_ids) !== null && _res$data5 !== void 0 && _res$data5.length) {
|
|
178
178
|
// 如果后端有返回 other_product_ids ,意味着有 duration 商品,则今天以及今天以后的日期均可用
|
|
179
179
|
dates.forEach(function (n) {
|
|
180
180
|
n.status = 'available';
|
|
181
181
|
});
|
|
182
182
|
} else {
|
|
183
|
-
res.data.date_list.forEach(function (n) {
|
|
183
|
+
(_res$data6 = res.data) === null || _res$data6 === void 0 || (_res$data6 = _res$data6.date_list) === null || _res$data6 === void 0 || _res$data6.forEach(function (n) {
|
|
184
184
|
var index = dates.findIndex(function (m) {
|
|
185
185
|
return m.date === n.date;
|
|
186
186
|
});
|
|
@@ -747,9 +747,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
747
747
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
748
748
|
var bundleItem = _step4.value;
|
|
749
749
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
750
|
-
var _ref13, _bundleItem$bundle_se2;
|
|
750
|
+
var _ref13, _bundleItem$bundle_se2, _ref14, _bundleItem$num;
|
|
751
751
|
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
752
|
-
var bundleItemTotal = new Decimal((_ref13 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref13 !== void 0 ? _ref13 : 0);
|
|
752
|
+
var bundleItemTotal = new Decimal((_ref13 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref13 !== void 0 ? _ref13 : 0).times((_ref14 = (_bundleItem$num = bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem.quantity) !== null && _ref14 !== void 0 ? _ref14 : 1);
|
|
753
753
|
total = total.add(bundleItemTotal);
|
|
754
754
|
}
|
|
755
755
|
}
|
|
@@ -869,12 +869,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
869
869
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
870
870
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
871
871
|
*/
|
|
872
|
-
export var getSurcharge = function getSurcharge(
|
|
872
|
+
export var getSurcharge = function getSurcharge(_ref15, options) {
|
|
873
873
|
var _service$filter;
|
|
874
|
-
var service =
|
|
875
|
-
addons =
|
|
876
|
-
bookingDetail =
|
|
877
|
-
bookingId =
|
|
874
|
+
var service = _ref15.service,
|
|
875
|
+
addons = _ref15.addons,
|
|
876
|
+
bookingDetail = _ref15.bookingDetail,
|
|
877
|
+
bookingId = _ref15.bookingId;
|
|
878
878
|
var isEdit = options.isEdit,
|
|
879
879
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
880
880
|
surcharge_list = options.surcharge_list,
|
|
@@ -996,11 +996,11 @@ export var getSurcharge = function getSurcharge(_ref14, options) {
|
|
|
996
996
|
scheduleById: scheduleById || {},
|
|
997
997
|
isInScheduleByDate: isInScheduleByDate
|
|
998
998
|
})) {
|
|
999
|
-
var
|
|
999
|
+
var _ref16, _bundleItem$bundle_se3;
|
|
1000
1000
|
var _mainQuantity = item.num || 1;
|
|
1001
1001
|
matchedItems.push({
|
|
1002
1002
|
isMain: false,
|
|
1003
|
-
total: Number((
|
|
1003
|
+
total: Number((_ref16 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref16 !== void 0 ? _ref16 : 0),
|
|
1004
1004
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
1005
1005
|
item: bundleItem,
|
|
1006
1006
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1216,9 +1216,9 @@ export var getSurcharge = function getSurcharge(_ref14, options) {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
return surchargeWithAmount;
|
|
1218
1218
|
};
|
|
1219
|
-
function resetItemsSurchargeSideEffects(
|
|
1220
|
-
var service =
|
|
1221
|
-
addons =
|
|
1219
|
+
function resetItemsSurchargeSideEffects(_ref17) {
|
|
1220
|
+
var service = _ref17.service,
|
|
1221
|
+
addons = _ref17.addons;
|
|
1222
1222
|
var resetItem = function resetItem(item) {
|
|
1223
1223
|
if (!item) return;
|
|
1224
1224
|
item.surcharge_fee = 0;
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
});
|
|
@@ -96,7 +96,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
custom_page_id,
|
|
97
97
|
channel
|
|
98
98
|
}) {
|
|
99
|
-
var _a, _b, _c;
|
|
99
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
100
100
|
if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
101
101
|
startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
|
|
102
102
|
}
|
|
@@ -114,17 +114,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
114
114
|
channel
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
|
-
this.setAvailabilityScheduleDateList(res.data.date_list);
|
|
118
|
-
this.setOtherProductsIds(res.data.other_product_ids || []);
|
|
119
|
-
if (!((
|
|
117
|
+
this.setAvailabilityScheduleDateList(((_a = res.data) == null ? void 0 : _a.date_list) || []);
|
|
118
|
+
this.setOtherProductsIds(((_b = res.data) == null ? void 0 : _b.other_product_ids) || []);
|
|
119
|
+
if (!((_d = (_c = res.data) == null ? void 0 : _c.date_list) == null ? void 0 : _d.length) && !((_f = (_e = res.data) == null ? void 0 : _e.other_product_ids) == null ? void 0 : _f.length) || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
120
120
|
return dates;
|
|
121
121
|
}
|
|
122
|
-
if ((
|
|
122
|
+
if ((_h = (_g = res.data) == null ? void 0 : _g.other_product_ids) == null ? void 0 : _h.length) {
|
|
123
123
|
dates.forEach((n) => {
|
|
124
124
|
n.status = "available";
|
|
125
125
|
});
|
|
126
126
|
} else {
|
|
127
|
-
res.data.date_list.forEach((n) => {
|
|
127
|
+
(_j = (_i = res.data) == null ? void 0 : _i.date_list) == null ? void 0 : _j.forEach((n) => {
|
|
128
128
|
const index = dates.findIndex((m) => m.date === n.date);
|
|
129
129
|
if (index !== -1) {
|
|
130
130
|
dates[index].status = "available";
|
|
@@ -470,7 +470,7 @@ var getMainProductTotal = (item) => {
|
|
|
470
470
|
}
|
|
471
471
|
for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
|
|
472
472
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
473
|
-
const bundleItemTotal = new import_decimal.default(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
|
|
473
|
+
const bundleItemTotal = new import_decimal.default(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0).times(bundleItem.num ?? bundleItem.quantity ?? 1);
|
|
474
474
|
total = total.add(bundleItemTotal);
|
|
475
475
|
}
|
|
476
476
|
}
|