@pisell/pisellos 2.0.67 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +1 -2
- package/dist/effects/index.d.ts +3 -4
- package/dist/effects/index.js +6 -15
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
- package/dist/modules/Cart/utils/changePrice.js +1 -1
- package/dist/modules/ProductList/index.d.ts +3 -14
- package/dist/modules/ProductList/index.js +33 -67
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +14 -27
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +50 -34
- package/dist/solution/BookingByStep/types.d.ts +3 -2
- package/dist/solution/BookingByStep/utils/resources.js +12 -4
- package/dist/solution/BuyTickets/index.d.ts +2 -2
- package/dist/solution/BuyTickets/index.js +1 -1
- package/dist/solution/ShopDiscount/index.js +2 -4
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +0 -1
- package/dist/types/index.d.ts +1 -3
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -4
- package/lib/effects/index.js +1 -4
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
- package/lib/modules/Cart/utils/changePrice.js +1 -1
- package/lib/modules/ProductList/index.d.ts +3 -14
- package/lib/modules/ProductList/index.js +14 -54
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/Rules/index.js +12 -20
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +39 -27
- package/lib/solution/BookingByStep/types.d.ts +3 -2
- package/lib/solution/BookingByStep/utils/resources.js +12 -4
- package/lib/solution/BuyTickets/index.d.ts +2 -2
- package/lib/solution/BuyTickets/index.js +1 -1
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +0 -2
- package/lib/types/index.d.ts +1 -3
- package/package.json +1 -1
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -697
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/solution/BookingTicket/index.d.ts +0 -172
- package/dist/solution/BookingTicket/index.js +0 -665
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -440
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/solution/BookingTicket/index.d.ts +0 -172
- package/lib/solution/BookingTicket/index.js +0 -399
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
|
@@ -28,7 +28,6 @@ import { RulesHooks } from "./types";
|
|
|
28
28
|
import { uniqueById } from "../../solution/ShopDiscount/utils";
|
|
29
29
|
import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
|
|
30
30
|
import Decimal from 'decimal.js';
|
|
31
|
-
import { isBoolean } from 'lodash-es';
|
|
32
31
|
export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
33
32
|
_inherits(RulesModule, _BaseModule);
|
|
34
33
|
var _super = _createSuper(RulesModule);
|
|
@@ -297,25 +296,19 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
297
296
|
|
|
298
297
|
// 记录可抵扣的商品详情
|
|
299
298
|
var applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
300
|
-
|
|
301
|
-
var productData = {
|
|
299
|
+
applicableProducts.push({
|
|
302
300
|
amount: product.price,
|
|
303
|
-
type:
|
|
304
|
-
tag:
|
|
301
|
+
type: discount.tag || discount.type,
|
|
302
|
+
tag: discount.tag || discount.type,
|
|
305
303
|
discount: {
|
|
306
304
|
resource_id: discount.id,
|
|
307
305
|
title: discount.format_title,
|
|
308
306
|
original_amount: product.origin_total,
|
|
309
307
|
pre_value: discount.par_value,
|
|
310
308
|
product_id: originProduct.id
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
// 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
|
|
315
|
-
if (discountType !== 'good_pass') {
|
|
316
|
-
productData.num = product.num || 1;
|
|
317
|
-
}
|
|
318
|
-
applicableProducts.push(productData);
|
|
309
|
+
},
|
|
310
|
+
num: product.num || 1
|
|
311
|
+
});
|
|
319
312
|
discountApplicableProducts.set(discount.id, applicableProducts);
|
|
320
313
|
}
|
|
321
314
|
});
|
|
@@ -337,10 +330,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
337
330
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
338
331
|
var _product$discount_lis6;
|
|
339
332
|
// 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
|
|
340
|
-
//
|
|
341
|
-
if ((Number(product.price)
|
|
342
|
-
//
|
|
343
|
-
if ((Number(product.total)
|
|
333
|
+
// 商品券时主商品价格为0不可用
|
|
334
|
+
if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
|
|
335
|
+
// 折扣卡时总价为0时不可用
|
|
336
|
+
if ((Number(product.total) === 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
|
|
344
337
|
var _n$discount;
|
|
345
338
|
return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
|
|
346
339
|
})) && (discount.tag || discount.type) !== 'good_pass') return false;
|
|
@@ -380,8 +373,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
380
373
|
}
|
|
381
374
|
|
|
382
375
|
// 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
|
|
383
|
-
|
|
384
|
-
if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
376
|
+
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
385
377
|
if (product.isClient) {
|
|
386
378
|
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
|
|
387
379
|
origin_total: getProductOriginTotalPrice({
|
|
@@ -457,23 +449,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
457
449
|
|
|
458
450
|
// 计算使用折扣卡/商品券以后,单个商品的总 total
|
|
459
451
|
var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(productOriginTotal).minus(new Decimal(product.price || 0)).toNumber() : new Decimal(100).minus(_selectedDiscount.par_value || 0).div(100).mul(new Decimal(productOriginTotal)).toNumber();
|
|
460
|
-
var discountType = _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag;
|
|
461
452
|
var discountDetail = {
|
|
462
453
|
amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
|
|
463
|
-
type:
|
|
454
|
+
type: _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag,
|
|
464
455
|
discount: {
|
|
465
456
|
resource_id: _selectedDiscount.id,
|
|
466
457
|
title: _selectedDiscount.format_title,
|
|
467
458
|
original_amount: productOriginTotal,
|
|
468
459
|
product_id: originProduct.id,
|
|
469
460
|
percent: _selectedDiscount.par_value
|
|
470
|
-
}
|
|
461
|
+
},
|
|
462
|
+
num: product.num || 1
|
|
471
463
|
};
|
|
472
|
-
|
|
473
|
-
// 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
|
|
474
|
-
if ((_selectedDiscount.tag || _selectedDiscount.type) !== 'good_pass') {
|
|
475
|
-
discountDetail.num = product.num || 1;
|
|
476
|
-
}
|
|
477
464
|
appliedProducts.push(discountDetail);
|
|
478
465
|
appliedDiscountProducts.set(_selectedDiscount.id, appliedProducts);
|
|
479
466
|
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/plugins/window.d.ts
CHANGED
|
@@ -701,6 +701,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
701
701
|
_params$useCache,
|
|
702
702
|
useCache,
|
|
703
703
|
tempProducts,
|
|
704
|
+
_this$store$currentPr,
|
|
704
705
|
dateRange,
|
|
705
706
|
tempStartDate,
|
|
706
707
|
tempEndDate,
|
|
@@ -732,8 +733,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
732
733
|
}
|
|
733
734
|
// 如果当前打开了某个的商品详情弹窗,则应该默认用这个商品
|
|
734
735
|
if (this.store.currentProduct) {
|
|
735
|
-
tempProducts = [_objectSpread(_objectSpread({}, this.store.currentProduct
|
|
736
|
-
_schedule: this.store.
|
|
736
|
+
tempProducts = [_objectSpread(_objectSpread({}, this.store.currentProduct), {}, {
|
|
737
|
+
_schedule: (_this$store$currentPr = this.store.currentProductMeta) === null || _this$store$currentPr === void 0 ? void 0 : _this$store$currentPr['schedule']
|
|
737
738
|
})];
|
|
738
739
|
}
|
|
739
740
|
dateRange = this.store.date.getDateRange();
|
|
@@ -2286,41 +2287,42 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2286
2287
|
key: "openProductDetail",
|
|
2287
2288
|
value: function () {
|
|
2288
2289
|
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(productId) {
|
|
2289
|
-
var
|
|
2290
|
+
var targetProductData, newScheduleArr, dateRange;
|
|
2290
2291
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2291
2292
|
while (1) switch (_context25.prev = _context25.next) {
|
|
2292
2293
|
case 0:
|
|
2293
2294
|
_context25.next = 2;
|
|
2294
2295
|
return this.store.products.getProduct(productId);
|
|
2295
2296
|
case 2:
|
|
2296
|
-
|
|
2297
|
-
if (!
|
|
2298
|
-
_context25.next =
|
|
2297
|
+
targetProductData = _context25.sent;
|
|
2298
|
+
if (!targetProductData) {
|
|
2299
|
+
_context25.next = 17;
|
|
2299
2300
|
break;
|
|
2300
2301
|
}
|
|
2301
|
-
|
|
2302
|
-
this.store.
|
|
2302
|
+
this.store.currentProduct = targetProductData;
|
|
2303
|
+
this.store.currentProductMeta = {};
|
|
2303
2304
|
// 资源预加载,如果是 duration 类型的商品,且是先选日期的流程,在这里预拉取资源数据
|
|
2304
2305
|
if (!targetProductData['schedule.ids']) {
|
|
2305
|
-
_context25.next =
|
|
2306
|
+
_context25.next = 12;
|
|
2306
2307
|
break;
|
|
2307
2308
|
}
|
|
2308
2309
|
newScheduleArr = this.getScheduleDataByIds(targetProductData['schedule.ids']);
|
|
2309
|
-
|
|
2310
|
-
|
|
2310
|
+
if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
|
|
2311
|
+
this.store.currentProductMeta.schedule = newScheduleArr;
|
|
2312
|
+
_context25.next = 17;
|
|
2311
2313
|
break;
|
|
2312
|
-
case
|
|
2314
|
+
case 12:
|
|
2313
2315
|
if (!targetProductData.duration) {
|
|
2314
|
-
_context25.next =
|
|
2316
|
+
_context25.next = 17;
|
|
2315
2317
|
break;
|
|
2316
2318
|
}
|
|
2317
2319
|
dateRange = this.store.date.getDateRange(); // 如果不是先选日期的流程 duration 商品就啥也不做
|
|
2318
2320
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
2319
|
-
_context25.next =
|
|
2321
|
+
_context25.next = 16;
|
|
2320
2322
|
break;
|
|
2321
2323
|
}
|
|
2322
2324
|
return _context25.abrupt("return");
|
|
2323
|
-
case
|
|
2325
|
+
case 16:
|
|
2324
2326
|
// this.store.date.getResourceDates({
|
|
2325
2327
|
// query: {
|
|
2326
2328
|
// start_date: dateRange[0].date,
|
|
@@ -2333,7 +2335,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2333
2335
|
endDate: dateRange[dateRange.length - 1].date,
|
|
2334
2336
|
products: [targetProductData]
|
|
2335
2337
|
});
|
|
2336
|
-
case
|
|
2338
|
+
case 17:
|
|
2337
2339
|
case "end":
|
|
2338
2340
|
return _context25.stop();
|
|
2339
2341
|
}
|
|
@@ -2347,8 +2349,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2347
2349
|
}, {
|
|
2348
2350
|
key: "closeProductDetail",
|
|
2349
2351
|
value: function closeProductDetail() {
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
+
if (this.store.currentProductMeta) {
|
|
2353
|
+
this.store.currentProductMeta.schedule = [];
|
|
2354
|
+
}
|
|
2352
2355
|
this.store.currentProduct = undefined;
|
|
2353
2356
|
}
|
|
2354
2357
|
}, {
|
|
@@ -2361,7 +2364,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2361
2364
|
product = _ref10.product;
|
|
2362
2365
|
var targetProduct = this.store.currentProduct;
|
|
2363
2366
|
// 如果外面传递了product 优先用外面的
|
|
2364
|
-
var targetProductData = product ||
|
|
2367
|
+
var targetProductData = product || targetProduct;
|
|
2365
2368
|
var targetSchedules = [];
|
|
2366
2369
|
// 如果外面传递了 scheduleIds,优先取入参
|
|
2367
2370
|
if (scheduleIds !== null && scheduleIds !== void 0 && scheduleIds.length) {
|
|
@@ -2376,7 +2379,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2376
2379
|
var cartItems = cloneDeep(this.store.cart.getItems());
|
|
2377
2380
|
var resourcesMap = getResourcesMap((targetResourceDate === null || targetResourceDate === void 0 ? void 0 : targetResourceDate.resource) || []);
|
|
2378
2381
|
var selectedResources = getOthersSelectedResources(cartItems, '', resourcesMap);
|
|
2379
|
-
var productResources = getResourcesByProduct(resourcesMap, resources || ((_this$store$currentPr2 = this.store.currentProduct) === null || _this$store$currentPr2 === void 0 || (_this$store$currentPr2 = _this$store$currentPr2.
|
|
2382
|
+
var productResources = getResourcesByProduct(resourcesMap, resources || ((_this$store$currentPr2 = this.store.currentProduct) === null || _this$store$currentPr2 === void 0 || (_this$store$currentPr2 = _this$store$currentPr2.product_resource) === null || _this$store$currentPr2 === void 0 ? void 0 : _this$store$currentPr2.resources) || [], selectedResources, 1);
|
|
2380
2383
|
var minTimeMaxTime = calcMinTimeMaxTimeBySchedules(targetSchedules, {}, date);
|
|
2381
2384
|
var scheduleTimeSlots = getAllSortedDateRanges(minTimeMaxTime);
|
|
2382
2385
|
// 当前所有待选择资源的集合,先提出来,提升性能
|
|
@@ -2496,22 +2499,34 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2496
2499
|
key: "getProductTypeById",
|
|
2497
2500
|
value: function () {
|
|
2498
2501
|
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
|
|
2499
|
-
var
|
|
2502
|
+
var productData, _productData$schedule;
|
|
2500
2503
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2501
2504
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2502
2505
|
case 0:
|
|
2503
2506
|
_context26.next = 2;
|
|
2504
2507
|
return this.store.products.getProduct(id);
|
|
2505
2508
|
case 2:
|
|
2506
|
-
|
|
2507
|
-
if (!
|
|
2508
|
-
_context26.next =
|
|
2509
|
+
productData = _context26.sent;
|
|
2510
|
+
if (!productData) {
|
|
2511
|
+
_context26.next = 9;
|
|
2509
2512
|
break;
|
|
2510
2513
|
}
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
+
if (!productData.duration) {
|
|
2515
|
+
_context26.next = 6;
|
|
2516
|
+
break;
|
|
2517
|
+
}
|
|
2518
|
+
return _context26.abrupt("return", 'duration');
|
|
2514
2519
|
case 6:
|
|
2520
|
+
if (!((_productData$schedule = productData['schedule.ids']) !== null && _productData$schedule !== void 0 && _productData$schedule.length)) {
|
|
2521
|
+
_context26.next = 8;
|
|
2522
|
+
break;
|
|
2523
|
+
}
|
|
2524
|
+
return _context26.abrupt("return", 'session');
|
|
2525
|
+
case 8:
|
|
2526
|
+
return _context26.abrupt("return", 'normal');
|
|
2527
|
+
case 9:
|
|
2528
|
+
return _context26.abrupt("return", 'normal');
|
|
2529
|
+
case 10:
|
|
2515
2530
|
case "end":
|
|
2516
2531
|
return _context26.stop();
|
|
2517
2532
|
}
|
|
@@ -2683,7 +2698,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2683
2698
|
key: "getAvailableDateForSessionOptimize",
|
|
2684
2699
|
value: function () {
|
|
2685
2700
|
var _getAvailableDateForSessionOptimize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2686
|
-
var _this$store$currentPr3, _this$store$currentPr4,
|
|
2701
|
+
var _this$store$currentPr3, _this$store$currentPr4, _tempProducts;
|
|
2687
2702
|
var params,
|
|
2688
2703
|
startDate,
|
|
2689
2704
|
endDate,
|
|
@@ -2729,7 +2744,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2729
2744
|
endDate = tempEndDate;
|
|
2730
2745
|
|
|
2731
2746
|
// 先去读缓存结果,因为正常 UI 调用的是 7 天,而下面我会直接计算 30 天(最少也是 14 天),所以先去读缓存结果,如果缓存结果存在,则直接返回
|
|
2732
|
-
cache = (_this$store$currentPr3 = this.store.
|
|
2747
|
+
cache = (_this$store$currentPr3 = this.store.currentProductMeta) === null || _this$store$currentPr3 === void 0 ? void 0 : _this$store$currentPr3['timeSlotBySchedule'];
|
|
2733
2748
|
if (!cache) {
|
|
2734
2749
|
_context29.next = 13;
|
|
2735
2750
|
break;
|
|
@@ -2745,8 +2760,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2745
2760
|
});
|
|
2746
2761
|
case 13:
|
|
2747
2762
|
// 如果当前打开了某个的商品详情弹窗,则应该默认用这个商品
|
|
2748
|
-
tempProducts =
|
|
2749
|
-
schedule = (_this$store$
|
|
2763
|
+
tempProducts = this.store.currentProduct;
|
|
2764
|
+
schedule = (_this$store$currentPr4 = this.store.currentProductMeta) === null || _this$store$currentPr4 === void 0 ? void 0 : _this$store$currentPr4['schedule'];
|
|
2750
2765
|
filteredSchedule = filterScheduleByDateRange(schedule, startDate || '', endDate || ''); // 1.后端返回的数据,确定资源在每一天的可用和使用情况
|
|
2751
2766
|
tempResourceIds = getResourcesIdsByProduct(tempProducts);
|
|
2752
2767
|
_context29.next = 19;
|
|
@@ -2906,17 +2921,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2906
2921
|
this.store.date.setDateList(dates);
|
|
2907
2922
|
|
|
2908
2923
|
// 缓存这次结果,以防后面他小幅度范围内去修改天数
|
|
2909
|
-
(
|
|
2924
|
+
if (!this.store.currentProductMeta) this.store.currentProductMeta = {};
|
|
2925
|
+
this.store.currentProductMeta.timeSlotBySchedule = {
|
|
2910
2926
|
dateList: dates,
|
|
2911
2927
|
firstAvailableDate: firstAvailableDate,
|
|
2912
2928
|
startDate: startDate,
|
|
2913
2929
|
endDate: dayjs(currentDate).format('YYYY-MM-DD')
|
|
2914
|
-
}
|
|
2930
|
+
};
|
|
2915
2931
|
return _context29.abrupt("return", {
|
|
2916
2932
|
dateList: dates,
|
|
2917
2933
|
firstAvailableDate: firstAvailableDate
|
|
2918
2934
|
});
|
|
2919
|
-
case
|
|
2935
|
+
case 39:
|
|
2920
2936
|
case "end":
|
|
2921
2937
|
return _context29.stop();
|
|
2922
2938
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule,
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -11,7 +11,8 @@ export interface BookingByStepState {
|
|
|
11
11
|
accountList: AccountListModule;
|
|
12
12
|
order: OrderModule;
|
|
13
13
|
payment: PaymentModule;
|
|
14
|
-
currentProduct?:
|
|
14
|
+
currentProduct?: ProductData;
|
|
15
|
+
currentProductMeta?: Record<string, any>;
|
|
15
16
|
schedule: ScheduleModule;
|
|
16
17
|
}
|
|
17
18
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
@@ -281,7 +281,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
|
|
|
281
281
|
onlyComputed: true,
|
|
282
282
|
// 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
|
|
283
283
|
metadata: _objectSpread(_objectSpread({}, resourcesMap[id].metadata), {}, {
|
|
284
|
-
combined_resource: resourcesMap[id].combined_resource
|
|
284
|
+
combined_resource: resourcesMap[id].combined_resource,
|
|
285
|
+
form_name: item.title,
|
|
286
|
+
resource_name: resourcesMap[id].main_field
|
|
285
287
|
})
|
|
286
288
|
}));
|
|
287
289
|
}
|
|
@@ -292,7 +294,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
|
|
|
292
294
|
resourceType: item.type,
|
|
293
295
|
children: combiningResources,
|
|
294
296
|
metadata: _objectSpread(_objectSpread({}, resourcesMap[d].metadata), {}, {
|
|
295
|
-
combined_resource: resourcesMap[d].combined_resource
|
|
297
|
+
combined_resource: resourcesMap[d].combined_resource,
|
|
298
|
+
form_name: item.title,
|
|
299
|
+
resource_name: resourcesMap[d].main_field
|
|
296
300
|
})
|
|
297
301
|
}));
|
|
298
302
|
}
|
|
@@ -315,7 +319,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
|
|
|
315
319
|
onlyComputed: true,
|
|
316
320
|
// 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
|
|
317
321
|
metadata: _objectSpread(_objectSpread({}, resourcesMap[id].metadata), {}, {
|
|
318
|
-
combined_resource: resourcesMap[id].combined_resource
|
|
322
|
+
combined_resource: resourcesMap[id].combined_resource,
|
|
323
|
+
form_name: item.title,
|
|
324
|
+
resource_name: resourcesMap[id].main_field
|
|
319
325
|
})
|
|
320
326
|
}));
|
|
321
327
|
}
|
|
@@ -327,7 +333,9 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
|
|
|
327
333
|
is_default: 1,
|
|
328
334
|
children: combiningResources,
|
|
329
335
|
metadata: _objectSpread(_objectSpread({}, resourcesMap[d].metadata), {}, {
|
|
330
|
-
combined_resource: resourcesMap[d].combined_resource
|
|
336
|
+
combined_resource: resourcesMap[d].combined_resource,
|
|
337
|
+
form_name: item.title,
|
|
338
|
+
resource_name: resourcesMap[d].main_field
|
|
331
339
|
})
|
|
332
340
|
}));
|
|
333
341
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module, PisellCore } from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { ProductData } from '../../modules/';
|
|
3
3
|
import { BaseModule } from '../../modules/BaseModule';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export declare class BuyTicketsImpl extends BaseModule implements Module {
|
|
@@ -16,7 +16,7 @@ export declare class BuyTicketsImpl extends BaseModule implements Module {
|
|
|
16
16
|
loadProductsByCategory(categoryId: number): Promise<void>;
|
|
17
17
|
destroy(): Promise<void>;
|
|
18
18
|
getProducts(): Promise<ProductData[]>;
|
|
19
|
-
getProduct(id: number): Promise<
|
|
19
|
+
getProduct(id: number): Promise<ProductData>;
|
|
20
20
|
listSubmit(data: Record<string, any>): Promise<{
|
|
21
21
|
status: boolean;
|
|
22
22
|
data: any;
|
|
@@ -238,7 +238,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
238
238
|
}
|
|
239
239
|
return _context6.abrupt("return", otherProduct);
|
|
240
240
|
case 10:
|
|
241
|
-
|
|
241
|
+
throw new Error("Product not found: ".concat(id));
|
|
242
242
|
case 11:
|
|
243
243
|
case "end":
|
|
244
244
|
return _context6.stop();
|
|
@@ -29,7 +29,6 @@ import { ShopDiscountHooks } from "./types";
|
|
|
29
29
|
import { DiscountModule } from "../../modules/Discount";
|
|
30
30
|
import { RulesModule } from "../../modules/Rules";
|
|
31
31
|
import Decimal from 'decimal.js';
|
|
32
|
-
import { isBoolean } from 'lodash-es';
|
|
33
32
|
export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
34
33
|
_inherits(ShopDiscountImpl, _BaseModule);
|
|
35
34
|
var _super = _createSuper(ShopDiscountImpl);
|
|
@@ -496,9 +495,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
496
495
|
return n.id === id;
|
|
497
496
|
});
|
|
498
497
|
var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
|
|
499
|
-
// 如果 product.total
|
|
500
|
-
|
|
501
|
-
return Number(product === null || product === void 0 ? void 0 : product.total) <= 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) <= 0 || !(product !== null && product !== void 0 && product.origin_total)) || isBoolean(product === null || product === void 0 ? void 0 : product.vouchersApplicable) && !(product !== null && product !== void 0 && product.vouchersApplicable);
|
|
498
|
+
// 如果 product.total 是 0有可能是她已经用过商品券或者折扣卡导致的 0,所以此时还需要判断 origin_total 是否为 0
|
|
499
|
+
return Number(product === null || product === void 0 ? void 0 : product.total) === 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) === 0 || !(product !== null && product !== void 0 && product.origin_total));
|
|
502
500
|
};
|
|
503
501
|
var allUsedProductIds = newDiscountList.map(function (n) {
|
|
504
502
|
var _n$appliedProductDeta;
|
package/dist/solution/index.d.ts
CHANGED
package/dist/solution/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -38,9 +38,7 @@ export interface PisellCore {
|
|
|
38
38
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
39
39
|
hasModule: (name: string) => boolean;
|
|
40
40
|
effects: {
|
|
41
|
-
on: (event: string, callback: (payload: any) => void) =>
|
|
42
|
-
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
|
-
off: (event: string, callback: (payload: any) => void) => void;
|
|
41
|
+
on: (event: string, callback: (payload: any) => void) => void;
|
|
44
42
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
45
43
|
status: boolean;
|
|
46
44
|
data: any;
|
package/lib/core/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var PisellOSCore = class {
|
|
|
61
61
|
console.log(`${prefix} ${message}`);
|
|
62
62
|
break;
|
|
63
63
|
case "warn":
|
|
64
|
-
console.
|
|
64
|
+
console.warn(`${prefix} ${message}`);
|
|
65
65
|
break;
|
|
66
66
|
case "error":
|
|
67
67
|
console.error(`${prefix} ${message}`);
|
package/lib/effects/index.d.ts
CHANGED
|
@@ -2,17 +2,16 @@ type EffectCallback = (payload: any) => void | Promise<void | {
|
|
|
2
2
|
status: boolean;
|
|
3
3
|
message?: string;
|
|
4
4
|
}>;
|
|
5
|
-
type UnsubscribeFunction = () => void;
|
|
6
5
|
declare class EffectsManager {
|
|
7
6
|
private listeners;
|
|
8
|
-
on(event: string, callback: EffectCallback):
|
|
7
|
+
on(event: string, callback: EffectCallback): void;
|
|
9
8
|
off(event: string, callback: EffectCallback): void;
|
|
10
9
|
offByModuleDestroy(module: string): void;
|
|
11
|
-
once(event: string, callback: EffectCallback):
|
|
10
|
+
once(event: string, callback: EffectCallback): void;
|
|
12
11
|
emit(event: string, payload: any): Promise<{
|
|
13
12
|
status: boolean;
|
|
14
13
|
data: any;
|
|
15
14
|
}>;
|
|
16
15
|
clear(): void;
|
|
17
16
|
}
|
|
18
|
-
export { EffectsManager
|
|
17
|
+
export { EffectsManager };
|
package/lib/effects/index.js
CHANGED
|
@@ -31,9 +31,6 @@ var EffectsManager = class {
|
|
|
31
31
|
if (!this.listeners.has(event))
|
|
32
32
|
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
33
33
|
(_a = this.listeners.get(event)) == null ? void 0 : _a.add(callback);
|
|
34
|
-
return () => {
|
|
35
|
-
this.off(event, callback);
|
|
36
|
-
};
|
|
37
34
|
}
|
|
38
35
|
off(event, callback) {
|
|
39
36
|
var _a;
|
|
@@ -52,7 +49,7 @@ var EffectsManager = class {
|
|
|
52
49
|
await callback(payload);
|
|
53
50
|
this.off(event, wrapper);
|
|
54
51
|
};
|
|
55
|
-
|
|
52
|
+
this.on(event, wrapper);
|
|
56
53
|
}
|
|
57
54
|
async emit(event, payload) {
|
|
58
55
|
const callbacks = this.listeners.get(event);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { AccountModule, Account } from '../Account';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
|
-
import { IFetchHolderAccountsParams, IHolder
|
|
4
|
+
import { IFetchHolderAccountsParams, IHolder } from './types';
|
|
5
5
|
export declare class AccountListModule extends BaseModule implements Module {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
@@ -37,12 +37,6 @@ export declare class AccountListModule extends BaseModule implements Module {
|
|
|
37
37
|
customerId: number;
|
|
38
38
|
type?: 'unshift' | 'push';
|
|
39
39
|
}): Promise<AccountModule[]>;
|
|
40
|
-
/**
|
|
41
|
-
* 获取客户列表
|
|
42
|
-
* @param params 查询参数
|
|
43
|
-
* @returns 客户列表
|
|
44
|
-
*/
|
|
45
|
-
getCustomerList(params?: IGetCustomerListParams): Promise<any>;
|
|
46
40
|
/**
|
|
47
41
|
* 获取holder类型账户列表
|
|
48
42
|
* @param params
|
|
@@ -288,33 +288,6 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
|
288
288
|
);
|
|
289
289
|
return accountModules;
|
|
290
290
|
}
|
|
291
|
-
/**
|
|
292
|
-
* 获取客户列表
|
|
293
|
-
* @param params 查询参数
|
|
294
|
-
* @returns 客户列表
|
|
295
|
-
*/
|
|
296
|
-
async getCustomerList(params = {}) {
|
|
297
|
-
const url = "/customer/es/data";
|
|
298
|
-
const { page = 1, pageSize = 20, keyword, ...otherParams } = params;
|
|
299
|
-
try {
|
|
300
|
-
this.store.isLoading = true;
|
|
301
|
-
this.store.error = null;
|
|
302
|
-
const queryParams = {
|
|
303
|
-
page,
|
|
304
|
-
pageSize,
|
|
305
|
-
...keyword && { keyword },
|
|
306
|
-
...otherParams
|
|
307
|
-
};
|
|
308
|
-
const res = await this.request.get(url, queryParams);
|
|
309
|
-
return (res == null ? void 0 : res.data) || [];
|
|
310
|
-
} catch (error) {
|
|
311
|
-
console.error("Failed to fetch customer list:", error);
|
|
312
|
-
this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
|
|
313
|
-
throw error;
|
|
314
|
-
} finally {
|
|
315
|
-
this.store.isLoading = false;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
291
|
/**
|
|
319
292
|
* 获取holder类型账户列表
|
|
320
293
|
* @param params
|
|
@@ -67,31 +67,3 @@ export interface IHolder {
|
|
|
67
67
|
main_field: string;
|
|
68
68
|
customer_cover?: string;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* 获取客户列表参数
|
|
72
|
-
*/
|
|
73
|
-
export interface IGetCustomerListParams {
|
|
74
|
-
/** 页码 */
|
|
75
|
-
page?: number;
|
|
76
|
-
/** 每页数量 */
|
|
77
|
-
pageSize?: number;
|
|
78
|
-
/** 搜索关键词 */
|
|
79
|
-
keyword?: string;
|
|
80
|
-
/** 其他筛选参数 */
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 客户数据
|
|
85
|
-
*/
|
|
86
|
-
export interface ICustomer {
|
|
87
|
-
/** 客户ID */
|
|
88
|
-
id: string | number;
|
|
89
|
-
/** 客户姓名 */
|
|
90
|
-
name: string;
|
|
91
|
-
/** 客户电话 */
|
|
92
|
-
phone?: string;
|
|
93
|
-
/** 客户邮箱 */
|
|
94
|
-
email?: string;
|
|
95
|
-
/** 其他客户信息 */
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProductData } from "../../Product";
|
|
2
2
|
import { CartItem, IUpdateItemParams } from "../types";
|
|
3
|
-
export declare function updateAllCartItemPrice(cartItems: CartItem[], priceData: any, getProduct: (id: number) => Promise<
|
|
3
|
+
export declare function updateAllCartItemPrice(cartItems: CartItem[], priceData: any, getProduct: (id: number) => Promise<ProductData | undefined>, updateCart: (item: IUpdateItemParams) => void, updateItemInitInfo: (item: IUpdateItemParams) => void): Promise<void>;
|
|
@@ -40,7 +40,7 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
|
|
|
40
40
|
const cartProduct = await getProduct(
|
|
41
41
|
item.id
|
|
42
42
|
);
|
|
43
|
-
let productInfo = cartProduct
|
|
43
|
+
let productInfo = cartProduct;
|
|
44
44
|
if (!productInfo) {
|
|
45
45
|
productInfo = item._productOrigin;
|
|
46
46
|
}
|