@pisell/pisellos 0.0.181 → 0.0.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Rules/index.js +8 -2
- package/dist/modules/Schedule/utils.js +4 -0
- package/dist/solution/BookingByStep/index.js +17 -6
- package/lib/modules/Rules/index.js +3 -2
- package/lib/modules/Schedule/utils.js +4 -1
- package/lib/solution/BookingByStep/index.js +3 -2
- package/package.json +1 -1
|
@@ -348,7 +348,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
348
348
|
});
|
|
349
349
|
|
|
350
350
|
// 选择第一个适用的优惠券(已经按过期时间排序)
|
|
351
|
-
|
|
351
|
+
// 如果有 isScan 且 isSelected 的折扣卡,则优先选中,否则再选择第一个
|
|
352
|
+
// 用于处理:先手动扫描了一张折扣卡,扫描完以后带入客户信息,但是之前那张折扣卡不是最优惠的情况
|
|
353
|
+
var selectedDiscountCard = applicableDiscounts.find(function (n) {
|
|
354
|
+
return n.isScan && n.isSelected && (n.tag || n.type) !== 'good_pass';
|
|
355
|
+
});
|
|
356
|
+
var selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
|
|
352
357
|
|
|
353
358
|
// 如果是手动折扣,则不适用优惠券
|
|
354
359
|
var isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || (product === null || product === void 0 || (_product$discount_lis7 = product.discount_list) === null || _product$discount_lis7 === void 0 || (_product$discount_lis8 = _product$discount_lis7.every) === null || _product$discount_lis8 === void 0 ? void 0 : _product$discount_lis8.call(_product$discount_lis7, function (item) {
|
|
@@ -418,7 +423,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
418
423
|
}));
|
|
419
424
|
}
|
|
420
425
|
for (var _i = 0; _i < splitCount; _i++) {
|
|
421
|
-
|
|
426
|
+
// 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
|
|
427
|
+
var _selectedDiscount = selectedDiscountCard || applicableDiscounts[_i];
|
|
422
428
|
// 标记优惠券为已使用
|
|
423
429
|
usedDiscounts.set(_selectedDiscount.id, true);
|
|
424
430
|
|
|
@@ -140,7 +140,11 @@ var getDaysByRepeatWeek = function getDaysByRepeatWeek(params, isGetRange) {
|
|
|
140
140
|
for (var i = 0; i < frequency_date.length; i++) {
|
|
141
141
|
var item = frequency_date[i];
|
|
142
142
|
var _start = startTmp.day(item);
|
|
143
|
+
// 如果周结束的那一天还超过了deadline,则需要把_end置为deadline
|
|
143
144
|
var _end = _start.add(scheduleDiff, 'second');
|
|
145
|
+
if (_end.isAfter(deadline, 'day')) {
|
|
146
|
+
_end = deadline;
|
|
147
|
+
}
|
|
144
148
|
if (isGetRange) {
|
|
145
149
|
if (excludedDaysMap.has(_start.format('YYYY-MM-DD'))) {
|
|
146
150
|
startTmp = startTmp.day(1).add(frequency, 'day');
|
|
@@ -272,7 +272,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
272
272
|
value: (function () {
|
|
273
273
|
var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
274
274
|
var _schedule$product_ids;
|
|
275
|
-
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, schedule, otherProductsIds, allProductIds;
|
|
275
|
+
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, newProductIds, schedule, otherProductsIds, allProductIds;
|
|
276
276
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
277
277
|
while (1) switch (_context3.prev = _context3.next) {
|
|
278
278
|
case 0:
|
|
@@ -289,27 +289,38 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
289
289
|
week: '',
|
|
290
290
|
weekNum: 0
|
|
291
291
|
}]);
|
|
292
|
+
newProductIds = []; // const scheduleIds = scheduleList
|
|
293
|
+
// .filter((n) => n.date === date)
|
|
294
|
+
// .flatMap((n) => n.schedule_id)
|
|
295
|
+
// .filter((n) => n !== null && n !== undefined);
|
|
296
|
+
// 如果外面没传 product_ids,尝试从对应 schedule 里拿 product_ids
|
|
297
|
+
// if (!product_ids?.length) {
|
|
298
|
+
// const schedule = scheduleList.find((n) => n.date === date);
|
|
299
|
+
// if (schedule && schedule.product_ids?.length) {
|
|
300
|
+
// product_ids = schedule.product_ids;
|
|
301
|
+
// }
|
|
302
|
+
// }
|
|
292
303
|
// V2接口修改后,只能从schedule 接口里拿数据,不可以从外面拿,外面给的是装修数据
|
|
293
304
|
schedule = scheduleList.find(function (n) {
|
|
294
305
|
return n.date === date;
|
|
295
306
|
});
|
|
296
307
|
if (schedule && (_schedule$product_ids = schedule.product_ids) !== null && _schedule$product_ids !== void 0 && _schedule$product_ids.length) {
|
|
297
|
-
|
|
308
|
+
newProductIds = schedule.product_ids;
|
|
298
309
|
}
|
|
299
310
|
// 尝试去拿schedule 里的 other_product_ids 和 product_ids 拼在一起去重
|
|
300
311
|
otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
301
|
-
allProductIds = [].concat(_toConsumableArray(
|
|
312
|
+
allProductIds = [].concat(_toConsumableArray(newProductIds), _toConsumableArray(otherProductsIds)).filter(function (n, index, self) {
|
|
302
313
|
return self.indexOf(n) === index;
|
|
303
314
|
});
|
|
304
|
-
_context3.next =
|
|
315
|
+
_context3.next = 10;
|
|
305
316
|
return this.loadProducts({
|
|
306
317
|
product_ids: allProductIds,
|
|
307
318
|
category_ids: category_ids,
|
|
308
319
|
schedule_date: date
|
|
309
320
|
});
|
|
310
|
-
case 9:
|
|
311
|
-
return _context3.abrupt("return", _context3.sent);
|
|
312
321
|
case 10:
|
|
322
|
+
return _context3.abrupt("return", _context3.sent);
|
|
323
|
+
case 11:
|
|
313
324
|
case "end":
|
|
314
325
|
return _context3.stop();
|
|
315
326
|
}
|
|
@@ -229,7 +229,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
229
229
|
}
|
|
230
230
|
return false;
|
|
231
231
|
});
|
|
232
|
-
const
|
|
232
|
+
const selectedDiscountCard = applicableDiscounts.find((n) => n.isScan && n.isSelected && (n.tag || n.type) !== "good_pass");
|
|
233
|
+
const selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
|
|
233
234
|
let isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : product.total != product.origin_total && (!((_c = product.discount_list) == null ? void 0 : _c.length) || ((_e = (_d = product == null ? void 0 : product.discount_list) == null ? void 0 : _d.every) == null ? void 0 : _e.call(_d, (item) => item.type === "product")));
|
|
234
235
|
if ((options == null ? void 0 : options.discountId) && ((_f = product.discount_list) == null ? void 0 : _f.some((item) => {
|
|
235
236
|
var _a2;
|
|
@@ -293,7 +294,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
293
294
|
}));
|
|
294
295
|
}
|
|
295
296
|
for (let i2 = 0; i2 < splitCount; i2++) {
|
|
296
|
-
const selectedDiscount2 = applicableDiscounts[i2];
|
|
297
|
+
const selectedDiscount2 = selectedDiscountCard || applicableDiscounts[i2];
|
|
297
298
|
usedDiscounts.set(selectedDiscount2.id, true);
|
|
298
299
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
299
300
|
const productOriginTotal = product.origin_total || product.total || 0;
|
|
@@ -140,7 +140,10 @@ var getDaysByRepeatWeek = (params, isGetRange) => {
|
|
|
140
140
|
for (let i = 0; i < frequency_date.length; i++) {
|
|
141
141
|
const item = frequency_date[i];
|
|
142
142
|
const _start = startTmp.day(item);
|
|
143
|
-
|
|
143
|
+
let _end = _start.add(scheduleDiff, "second");
|
|
144
|
+
if (_end.isAfter(deadline, "day")) {
|
|
145
|
+
_end = deadline;
|
|
146
|
+
}
|
|
144
147
|
if (isGetRange) {
|
|
145
148
|
if (excludedDaysMap.has(_start.format("YYYY-MM-DD"))) {
|
|
146
149
|
startTmp = startTmp.day(1).add(frequency, "day");
|
|
@@ -217,12 +217,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
217
217
|
{ date, status: "available", week: "", weekNum: 0 },
|
|
218
218
|
{ date, status: "available", week: "", weekNum: 0 }
|
|
219
219
|
]);
|
|
220
|
+
let newProductIds = [];
|
|
220
221
|
const schedule = scheduleList.find((n) => n.date === date);
|
|
221
222
|
if (schedule && ((_a = schedule.product_ids) == null ? void 0 : _a.length)) {
|
|
222
|
-
|
|
223
|
+
newProductIds = schedule.product_ids;
|
|
223
224
|
}
|
|
224
225
|
const otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
225
|
-
const allProductIds = [...
|
|
226
|
+
const allProductIds = [...newProductIds, ...otherProductsIds].filter(
|
|
226
227
|
(n, index, self) => self.indexOf(n) === index
|
|
227
228
|
);
|
|
228
229
|
return await this.loadProducts({
|