@pisell/pisellos 3.0.35 → 3.0.36
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/Cart/index.js +20 -34
- package/dist/modules/Cart/utils/cartAccount.d.ts +21 -0
- package/dist/modules/Cart/utils/cartAccount.js +52 -0
- package/dist/modules/Cart/utils/cartDate.d.ts +31 -0
- package/dist/modules/Cart/utils/cartDate.js +55 -0
- package/dist/modules/Cart/utils/cartDiscount.d.ts +19 -0
- package/dist/modules/Cart/utils/cartDiscount.js +35 -0
- package/dist/modules/Cart/utils/cartNote.d.ts +19 -0
- package/dist/modules/Cart/utils/cartNote.js +29 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +107 -0
- package/dist/modules/Cart/{utils.js → utils/cartProduct.js} +77 -416
- package/dist/modules/Cart/utils/cartRelationForms.d.ts +26 -0
- package/dist/modules/Cart/utils/cartRelationForms.js +29 -0
- package/dist/modules/Cart/utils/cartResource.d.ts +21 -0
- package/dist/modules/Cart/utils/cartResource.js +102 -0
- package/dist/modules/Cart/utils/index.d.ts +34 -0
- package/dist/modules/Cart/utils/index.js +63 -0
- package/dist/modules/Order/index.js +10 -4
- package/dist/modules/Product/types.d.ts +4 -0
- package/dist/modules/Product/utils.d.ts +17 -0
- package/dist/modules/Product/utils.js +41 -0
- package/dist/solution/BookingByStep/index.d.ts +8 -1
- package/dist/solution/BookingByStep/index.js +182 -63
- package/lib/modules/Cart/index.js +16 -24
- package/lib/modules/Cart/utils/cartAccount.d.ts +21 -0
- package/lib/modules/Cart/utils/cartAccount.js +65 -0
- package/lib/modules/Cart/utils/cartDate.d.ts +31 -0
- package/lib/modules/Cart/utils/cartDate.js +75 -0
- package/lib/modules/Cart/utils/cartDiscount.d.ts +19 -0
- package/lib/modules/Cart/utils/cartDiscount.js +52 -0
- package/lib/modules/Cart/utils/cartNote.d.ts +19 -0
- package/lib/modules/Cart/utils/cartNote.js +46 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +107 -0
- package/lib/modules/Cart/{utils.js → utils/cartProduct.js} +78 -328
- package/lib/modules/Cart/utils/cartRelationForms.d.ts +26 -0
- package/lib/modules/Cart/utils/cartRelationForms.js +48 -0
- package/lib/modules/Cart/utils/cartResource.d.ts +21 -0
- package/lib/modules/Cart/utils/cartResource.js +124 -0
- package/lib/modules/Cart/utils/index.d.ts +34 -0
- package/lib/modules/Cart/utils/index.js +91 -0
- package/lib/modules/Order/index.js +7 -3
- package/lib/modules/Product/types.d.ts +4 -0
- package/lib/modules/Product/utils.d.ts +17 -0
- package/lib/modules/Product/utils.js +46 -0
- package/lib/solution/BookingByStep/index.d.ts +8 -1
- package/lib/solution/BookingByStep/index.js +106 -40
- package/package.json +1 -1
- package/dist/modules/Cart/utils.d.ts +0 -257
- package/lib/modules/Cart/utils.d.ts +0 -257
|
@@ -43,6 +43,7 @@ var import_utils = require("../../modules/Resource/utils");
|
|
|
43
43
|
var import_lodash_es = require("lodash-es");
|
|
44
44
|
var import_utils2 = require("../../modules/Schedule/utils");
|
|
45
45
|
var import_utils3 = require("../../modules/Date/utils");
|
|
46
|
+
var import_utils4 = require("../../modules/Product/utils");
|
|
46
47
|
var import_timeslots = require("./utils/timeslots");
|
|
47
48
|
import_dayjs.default.extend(import_isSameOrBefore.default);
|
|
48
49
|
import_dayjs.default.extend(import_isSameOrAfter.default);
|
|
@@ -179,12 +180,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
179
180
|
{
|
|
180
181
|
open_quotation: 1,
|
|
181
182
|
open_bundle: 0,
|
|
182
|
-
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
183
|
+
exclude_extension_type: [
|
|
184
|
+
"product_party",
|
|
185
|
+
"product_event",
|
|
186
|
+
"product_series_event",
|
|
187
|
+
"product_package_ticket",
|
|
188
|
+
"ticket",
|
|
189
|
+
"event_item"
|
|
188
190
|
],
|
|
189
191
|
with: ["category", "collection", "resourceRelation"],
|
|
190
192
|
status: "published",
|
|
@@ -340,12 +342,30 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
340
342
|
}
|
|
341
343
|
async storeProduct(productData) {
|
|
342
344
|
const activeAccount = this.getActiveAccount();
|
|
343
|
-
const { bundle, options, origin, product_variant_id } = productData || {};
|
|
344
|
-
const
|
|
345
|
+
const { bundle, options, origin, product_variant_id, quantity = 1, rowKey } = productData || {};
|
|
346
|
+
const cartItems = this.store.cart.getItems();
|
|
347
|
+
if (rowKey) {
|
|
348
|
+
const targetCartItem = cartItems.find((n) => {
|
|
349
|
+
var _a;
|
|
350
|
+
return ((_a = n._productOrigin) == null ? void 0 : _a.rowKey) === rowKey;
|
|
351
|
+
});
|
|
352
|
+
if (targetCartItem && (0, import_utils4.isNormalProduct)(targetCartItem._productOrigin)) {
|
|
353
|
+
this.store.cart.updateItem({
|
|
354
|
+
_id: targetCartItem._id,
|
|
355
|
+
product: {
|
|
356
|
+
...targetCartItem._productOrigin
|
|
357
|
+
},
|
|
358
|
+
quantity: (targetCartItem.num || 1) + quantity
|
|
359
|
+
});
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const product = { ...origin, product_variant_id, rowKey };
|
|
345
364
|
const addCartItem = {
|
|
346
365
|
product,
|
|
347
366
|
bundle,
|
|
348
|
-
options
|
|
367
|
+
options,
|
|
368
|
+
quantity
|
|
349
369
|
};
|
|
350
370
|
if (activeAccount) {
|
|
351
371
|
addCartItem.account = activeAccount;
|
|
@@ -414,12 +434,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
414
434
|
* @param params
|
|
415
435
|
*/
|
|
416
436
|
async fetchHolderAccountsAsync(params) {
|
|
417
|
-
var _a, _b
|
|
437
|
+
var _a, _b;
|
|
418
438
|
const cartItems = this.store.cart.getItems();
|
|
419
439
|
if (cartItems.length) {
|
|
420
440
|
let date = (_b = (_a = this.store.date.getDateRange()) == null ? void 0 : _a[0]) == null ? void 0 : _b.date;
|
|
421
441
|
if (!date) {
|
|
422
|
-
|
|
442
|
+
const normalProductCartItem = cartItems.find((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
443
|
+
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
423
444
|
}
|
|
424
445
|
this.updateQuotationPriceAndCart(date);
|
|
425
446
|
}
|
|
@@ -506,7 +527,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
506
527
|
}
|
|
507
528
|
// 如果用户登录
|
|
508
529
|
async setLoginAccount(accountId, accountInfo) {
|
|
509
|
-
var _a, _b
|
|
530
|
+
var _a, _b;
|
|
510
531
|
const account = this.store.accountList.getAccount(accountId);
|
|
511
532
|
if (account) {
|
|
512
533
|
let stateAccountId = account.getId();
|
|
@@ -525,7 +546,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
525
546
|
if (cartItems.length) {
|
|
526
547
|
let date = (_b = (_a = this.store.date.getDateRange()) == null ? void 0 : _a[0]) == null ? void 0 : _b.date;
|
|
527
548
|
if (!date) {
|
|
528
|
-
|
|
549
|
+
const normalProductCartItem = cartItems.find((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
550
|
+
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
529
551
|
}
|
|
530
552
|
this.updateQuotationPriceAndCart(date);
|
|
531
553
|
}
|
|
@@ -578,7 +600,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
578
600
|
item._origin.number = currentCapacity;
|
|
579
601
|
}
|
|
580
602
|
});
|
|
581
|
-
|
|
603
|
+
let type = this.otherParams.isRetailTemplate ? "virtual" : "appointment_booking";
|
|
604
|
+
if ((0, import_utils4.areAllNormalProducts)(newCartItems.map((n) => n._productOrigin))) {
|
|
605
|
+
type = "virtual";
|
|
606
|
+
}
|
|
582
607
|
return this.store.order.submitOrder({ query: { cartItems: newCartItems, type } });
|
|
583
608
|
}
|
|
584
609
|
// 拉起支付模块
|
|
@@ -755,7 +780,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
755
780
|
* @returns 不符合条件的购物车商品ID列表
|
|
756
781
|
*/
|
|
757
782
|
checkCartItems(type) {
|
|
758
|
-
const cartItems = this.store.cart.getItems();
|
|
783
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
759
784
|
const errorCartItemIds = [];
|
|
760
785
|
cartItems.forEach((cartItem) => {
|
|
761
786
|
const result = this.store.cart.checkCartItemByType(cartItem, type);
|
|
@@ -794,7 +819,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
794
819
|
});
|
|
795
820
|
}
|
|
796
821
|
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
|
|
797
|
-
const cartItems = this.store.cart.getItems();
|
|
822
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
798
823
|
const arr = [];
|
|
799
824
|
cartItems.forEach((cartItem) => {
|
|
800
825
|
var _a, _b, _c;
|
|
@@ -923,7 +948,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
923
948
|
});
|
|
924
949
|
}
|
|
925
950
|
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
|
|
926
|
-
const cartItems = this.store.cart.getItems();
|
|
951
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
927
952
|
const arr = [];
|
|
928
953
|
cartItems.forEach((cartItem) => {
|
|
929
954
|
var _a, _b, _c;
|
|
@@ -1037,7 +1062,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1037
1062
|
// 给单个购物车里的商品获取资源列表
|
|
1038
1063
|
getResourcesListByCartItem(id) {
|
|
1039
1064
|
var _a, _b, _c;
|
|
1040
|
-
const cartItems =
|
|
1065
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1041
1066
|
const dateRange = this.store.date.getDateRange();
|
|
1042
1067
|
const resources = [];
|
|
1043
1068
|
dateRange.forEach((n) => {
|
|
@@ -1120,6 +1145,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1120
1145
|
capacity
|
|
1121
1146
|
}) {
|
|
1122
1147
|
var _a, _b, _c;
|
|
1148
|
+
if ((0, import_utils4.isNormalProduct)(cartItem._productOrigin)) {
|
|
1149
|
+
return {};
|
|
1150
|
+
}
|
|
1123
1151
|
const dateRange = this.store.date.getDateRange();
|
|
1124
1152
|
const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1125
1153
|
let accountCartItems = cartItems.filter((n) => n.holder_id === holder_id) || [];
|
|
@@ -1423,7 +1451,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1423
1451
|
}
|
|
1424
1452
|
});
|
|
1425
1453
|
};
|
|
1426
|
-
const cartItems =
|
|
1454
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1427
1455
|
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
1428
1456
|
accountList.forEach((account) => {
|
|
1429
1457
|
const cartItems2 = this.store.cart.getCartByAccount(account.getId());
|
|
@@ -1439,7 +1467,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1439
1467
|
var _a, _b, _c, _d, _e, _f;
|
|
1440
1468
|
let dateRange = this.store.date.getDateRange();
|
|
1441
1469
|
const resources = [];
|
|
1442
|
-
const cartItems =
|
|
1470
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1443
1471
|
const resourceIds = [];
|
|
1444
1472
|
let resourcesTypeId = void 0;
|
|
1445
1473
|
let isSingleResource = false;
|
|
@@ -1537,7 +1565,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1537
1565
|
}
|
|
1538
1566
|
// 提交时间切片,绑定到对应购物车的商品上,更新购物车
|
|
1539
1567
|
submitTimeSlot(timeSlots) {
|
|
1540
|
-
const cartItems =
|
|
1568
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1541
1569
|
const itemsByAccount = cartItems.reduce(
|
|
1542
1570
|
(acc, item) => {
|
|
1543
1571
|
const holderId = item.holder_id;
|
|
@@ -1623,7 +1651,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1623
1651
|
resources,
|
|
1624
1652
|
product
|
|
1625
1653
|
}) {
|
|
1626
|
-
var _a, _b, _c;
|
|
1654
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1627
1655
|
const targetProduct = this.store.currentProduct;
|
|
1628
1656
|
const targetProductData = product || (targetProduct == null ? void 0 : targetProduct.getData());
|
|
1629
1657
|
let targetSchedules = [];
|
|
@@ -1657,15 +1685,16 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1657
1685
|
const scheduleTimeSlots = (0, import_utils2.getAllSortedDateRanges)(minTimeMaxTime);
|
|
1658
1686
|
let allProductResources = productResources.flatMap((n) => n.renderList);
|
|
1659
1687
|
allProductResources.sort((a, b) => {
|
|
1660
|
-
var _a2, _b2, _c2,
|
|
1688
|
+
var _a2, _b2, _c2, _d2;
|
|
1661
1689
|
const aIsCombined = ((_b2 = (_a2 = a.metadata) == null ? void 0 : _a2.combined_resource) == null ? void 0 : _b2.status) === 1;
|
|
1662
|
-
const bIsCombined = ((
|
|
1690
|
+
const bIsCombined = ((_d2 = (_c2 = b.metadata) == null ? void 0 : _c2.combined_resource) == null ? void 0 : _d2.status) === 1;
|
|
1663
1691
|
if (aIsCombined && !bIsCombined)
|
|
1664
1692
|
return 1;
|
|
1665
1693
|
if (!aIsCombined && bIsCombined)
|
|
1666
1694
|
return -1;
|
|
1667
1695
|
return 0;
|
|
1668
1696
|
});
|
|
1697
|
+
const firstEnabledResourceId = (_f = (_e = (_d = targetProductData == null ? void 0 : targetProductData.product_resource) == null ? void 0 : _d.resources) == null ? void 0 : _e.find((n) => n.status === 1)) == null ? void 0 : _f.id;
|
|
1669
1698
|
const formatScheduleTimeSlots = scheduleTimeSlots.map((item) => {
|
|
1670
1699
|
const resourcesUseableMap = {};
|
|
1671
1700
|
let count = 0;
|
|
@@ -1701,7 +1730,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1701
1730
|
}
|
|
1702
1731
|
currentResourcesTimeSlotCanUsedArr.push(res.usable);
|
|
1703
1732
|
});
|
|
1704
|
-
if (!currentResourcesTimeSlotCanUsedArr.some((n) => n === false)) {
|
|
1733
|
+
if (!currentResourcesTimeSlotCanUsedArr.some((n) => n === false) && m.form_id === firstEnabledResourceId) {
|
|
1705
1734
|
if (currentResourcesCount >= count) {
|
|
1706
1735
|
count = currentResourcesCount;
|
|
1707
1736
|
}
|
|
@@ -1728,7 +1757,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1728
1757
|
date,
|
|
1729
1758
|
account
|
|
1730
1759
|
}) {
|
|
1731
|
-
const { bundle, options, origin, product_variant_id } = product || {};
|
|
1760
|
+
const { bundle, options, origin, product_variant_id, rowKey, quantity = 1 } = product || {};
|
|
1732
1761
|
const productData = { ...origin, product_variant_id };
|
|
1733
1762
|
if (!account) {
|
|
1734
1763
|
const activeAccount = this.getActiveAccount();
|
|
@@ -1736,15 +1765,33 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1736
1765
|
account = activeAccount;
|
|
1737
1766
|
}
|
|
1738
1767
|
}
|
|
1768
|
+
if (rowKey) {
|
|
1769
|
+
const cartItems = this.store.cart.getItems();
|
|
1770
|
+
const targetCartItem = cartItems.find((n) => {
|
|
1771
|
+
var _a;
|
|
1772
|
+
return ((_a = n._productOrigin) == null ? void 0 : _a.rowKey) === rowKey;
|
|
1773
|
+
});
|
|
1774
|
+
if (targetCartItem && (0, import_utils4.isNormalProduct)(targetCartItem._productOrigin)) {
|
|
1775
|
+
this.store.cart.updateItem({
|
|
1776
|
+
_id: targetCartItem._id,
|
|
1777
|
+
product: {
|
|
1778
|
+
...targetCartItem._productOrigin,
|
|
1779
|
+
quantity: (targetCartItem.num || 1) + quantity
|
|
1780
|
+
}
|
|
1781
|
+
});
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1739
1785
|
this.store.cart.addItem({
|
|
1740
1786
|
product: productData,
|
|
1741
1787
|
date,
|
|
1742
1788
|
account,
|
|
1743
1789
|
bundle,
|
|
1744
|
-
options
|
|
1790
|
+
options,
|
|
1791
|
+
quantity
|
|
1745
1792
|
});
|
|
1746
1793
|
if (date) {
|
|
1747
|
-
const cartItems =
|
|
1794
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1748
1795
|
const cartItemsByDate = cartItems.filter(
|
|
1749
1796
|
(n) => !(0, import_dayjs.default)(n.start_date).isSame((0, import_dayjs.default)(date.startTime), "day")
|
|
1750
1797
|
);
|
|
@@ -1800,7 +1847,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1800
1847
|
});
|
|
1801
1848
|
}
|
|
1802
1849
|
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
|
|
1803
|
-
const cartItems = this.store.cart.getItems();
|
|
1850
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1804
1851
|
const cartItem = cartItems.find((item) => item._id === cartItemId);
|
|
1805
1852
|
if (!cartItem)
|
|
1806
1853
|
return [];
|
|
@@ -1986,23 +2033,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1986
2033
|
}
|
|
1987
2034
|
async getAvailableDateForSessionOptimize(params = {}) {
|
|
1988
2035
|
var _a, _b, _c, _d, _e, _f;
|
|
1989
|
-
const cache = (_a = this.store.currentProduct) == null ? void 0 : _a.getOtherParams()["timeSlotBySchedule"];
|
|
1990
|
-
if (cache) {
|
|
1991
|
-
if ((0, import_dayjs.default)(params.startDate).isSameOrAfter((0, import_dayjs.default)(cache.startDate), "day") && (0, import_dayjs.default)(params.endDate).isSameOrBefore((0, import_dayjs.default)(cache.endDate), "day")) {
|
|
1992
|
-
return {
|
|
1993
|
-
dateList: cache.dateList,
|
|
1994
|
-
firstAvailableDate: cache.firstAvailableDate
|
|
1995
|
-
};
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
2036
|
let { startDate, endDate } = params;
|
|
1999
2037
|
if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day") && ((0, import_dayjs.default)(endDate).isAfter((0, import_dayjs.default)(), "day") || (0, import_dayjs.default)(endDate).isSame((0, import_dayjs.default)(), "day"))) {
|
|
2000
2038
|
startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
|
|
2001
2039
|
}
|
|
2002
2040
|
endDate = (0, import_dayjs.default)().add(1, "month").format("YYYY-MM-DD");
|
|
2003
2041
|
let tempProducts;
|
|
2004
|
-
tempProducts = (
|
|
2005
|
-
const schedule = (
|
|
2042
|
+
tempProducts = (_a = this.store.currentProduct) == null ? void 0 : _a.getData();
|
|
2043
|
+
const schedule = (_b = this.store.currentProduct) == null ? void 0 : _b.getOtherParams()["schedule"];
|
|
2006
2044
|
const filteredSchedule = (0, import_resources.filterScheduleByDateRange)(
|
|
2007
2045
|
schedule,
|
|
2008
2046
|
startDate || "",
|
|
@@ -2016,6 +2054,16 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2016
2054
|
resource_ids: tempResourceIds
|
|
2017
2055
|
}
|
|
2018
2056
|
});
|
|
2057
|
+
const cache = (_c = this.store.currentProduct) == null ? void 0 : _c.getOtherParams()["timeSlotBySchedule"];
|
|
2058
|
+
if (cache) {
|
|
2059
|
+
if ((0, import_dayjs.default)(params.startDate).isSameOrAfter((0, import_dayjs.default)(cache.startDate), "day") && (0, import_dayjs.default)(params.endDate).isSameOrBefore((0, import_dayjs.default)(cache.endDate), "day")) {
|
|
2060
|
+
this.store.date.setDateList(cache.dateList);
|
|
2061
|
+
return {
|
|
2062
|
+
dateList: cache.dateList,
|
|
2063
|
+
firstAvailableDate: cache.firstAvailableDate
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2019
2067
|
let dates = [];
|
|
2020
2068
|
let currentDate = (0, import_dayjs.default)(startDate);
|
|
2021
2069
|
let firstAvailableDate = "";
|
|
@@ -2129,6 +2177,24 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2129
2177
|
firstAvailableDate
|
|
2130
2178
|
};
|
|
2131
2179
|
}
|
|
2180
|
+
isCartAllNormalProducts() {
|
|
2181
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
2182
|
+
return !cartItems.length;
|
|
2183
|
+
}
|
|
2184
|
+
isCartHasDurationProduct() {
|
|
2185
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
2186
|
+
return cartItems.some((n) => {
|
|
2187
|
+
var _a;
|
|
2188
|
+
return (_a = n._productOrigin) == null ? void 0 : _a.duration;
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2191
|
+
isTargetNormalProduct(product) {
|
|
2192
|
+
return (0, import_utils4.isNormalProduct)(product);
|
|
2193
|
+
}
|
|
2194
|
+
isTargetCartIdNormalProduct(id) {
|
|
2195
|
+
const cartItem = this.store.cart.getItems().find((n) => n._id === id);
|
|
2196
|
+
return cartItem && (0, import_utils4.isNormalProduct)(cartItem._productOrigin);
|
|
2197
|
+
}
|
|
2132
2198
|
};
|
|
2133
2199
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2134
2200
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { Account } from '../Account';
|
|
2
|
-
import { ProductData } from '../Product/types';
|
|
3
|
-
import { Resource } from '../Resource/types';
|
|
4
|
-
import { CartItem, IDiscount } from './types';
|
|
5
|
-
import Decimal from 'decimal.js';
|
|
6
|
-
/**
|
|
7
|
-
* 生成一个唯一的 ID
|
|
8
|
-
*/
|
|
9
|
-
export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
|
|
10
|
-
/**
|
|
11
|
-
* 创建购物车原始数据
|
|
12
|
-
*/
|
|
13
|
-
export declare const createCartItemOrigin: () => {
|
|
14
|
-
id: number;
|
|
15
|
-
number: number;
|
|
16
|
-
registration_type: string;
|
|
17
|
-
relation_products: never[];
|
|
18
|
-
is_all: boolean;
|
|
19
|
-
product: null;
|
|
20
|
-
sub_type: null;
|
|
21
|
-
duration: null;
|
|
22
|
-
like_status: string;
|
|
23
|
-
resources: null;
|
|
24
|
-
schedule_id: number;
|
|
25
|
-
start_date: null;
|
|
26
|
-
start_time: null;
|
|
27
|
-
select_date: null;
|
|
28
|
-
end_time: null;
|
|
29
|
-
end_date: null;
|
|
30
|
-
metadata: {};
|
|
31
|
-
holder: null;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* 格式化商品到购物车
|
|
35
|
-
* @param product 商品
|
|
36
|
-
* @returns 格式化后的商品
|
|
37
|
-
*/
|
|
38
|
-
export declare const formatProductToCartItem: (params: {
|
|
39
|
-
cartItem: CartItem;
|
|
40
|
-
product: ProductData;
|
|
41
|
-
bundle?: any;
|
|
42
|
-
options?: any;
|
|
43
|
-
product_variant_id?: number;
|
|
44
|
-
}) => CartItem;
|
|
45
|
-
export declare const formatProductToCartItemOrigin: (params: {
|
|
46
|
-
cartItem: CartItem;
|
|
47
|
-
product: ProductData;
|
|
48
|
-
bundle?: any;
|
|
49
|
-
options?: any;
|
|
50
|
-
product_variant_id?: number;
|
|
51
|
-
}) => any;
|
|
52
|
-
/**
|
|
53
|
-
* 格式化折扣到购物车
|
|
54
|
-
* @param params 参数
|
|
55
|
-
* @returns 格式化后的购物车
|
|
56
|
-
*/
|
|
57
|
-
export declare const formatDiscountToCartItem: (params: {
|
|
58
|
-
cartItem: CartItem;
|
|
59
|
-
discounts: IDiscount[];
|
|
60
|
-
}) => CartItem;
|
|
61
|
-
/**
|
|
62
|
-
* 格式化折扣到购物车原始数据
|
|
63
|
-
* @param params 参数
|
|
64
|
-
* @returns 格式化后的购物车原始数据
|
|
65
|
-
*/
|
|
66
|
-
export declare const formatDiscountToCartItemOrigin: (params: {
|
|
67
|
-
cartItem: CartItem;
|
|
68
|
-
discounts: IDiscount[];
|
|
69
|
-
}) => any;
|
|
70
|
-
/**
|
|
71
|
-
* 格式化账户到购物车
|
|
72
|
-
* @param account 账户
|
|
73
|
-
* @returns 格式化后的账户
|
|
74
|
-
*/
|
|
75
|
-
export declare const formatAccountToCartItem: (params: {
|
|
76
|
-
cartItem: CartItem;
|
|
77
|
-
account: Account;
|
|
78
|
-
}) => CartItem;
|
|
79
|
-
export declare const formatAccountToCartItemOrigin: (params: {
|
|
80
|
-
cartItem: CartItem;
|
|
81
|
-
account: Account;
|
|
82
|
-
}) => any;
|
|
83
|
-
/**
|
|
84
|
-
* 格式化资源到购物车
|
|
85
|
-
* @param resource 资源
|
|
86
|
-
* @returns 格式化后的资源
|
|
87
|
-
*/
|
|
88
|
-
export declare const formatResourceToCartItem: (params: {
|
|
89
|
-
cartItem: CartItem;
|
|
90
|
-
resources: Resource[];
|
|
91
|
-
}) => CartItem;
|
|
92
|
-
export declare const formatResourceToCartItemOrigin: (params: {
|
|
93
|
-
cartItem: CartItem;
|
|
94
|
-
resources: Resource[];
|
|
95
|
-
}) => any;
|
|
96
|
-
/**
|
|
97
|
-
* 格式化关联表单到购物车
|
|
98
|
-
* @param params 参数
|
|
99
|
-
* @returns 格式化后的购物车
|
|
100
|
-
*/
|
|
101
|
-
export declare const formatRelationFormsToCartItem: (params: {
|
|
102
|
-
cartItem: CartItem;
|
|
103
|
-
relationForms: {
|
|
104
|
-
form_id: number;
|
|
105
|
-
form_record_ids: number[];
|
|
106
|
-
}[];
|
|
107
|
-
}) => CartItem;
|
|
108
|
-
export declare const formatRelationFormsToCartItemOrigin: (params: {
|
|
109
|
-
cartItem: CartItem;
|
|
110
|
-
relationForms: {
|
|
111
|
-
form_id: number;
|
|
112
|
-
form_record_ids: number[];
|
|
113
|
-
}[];
|
|
114
|
-
}) => any;
|
|
115
|
-
/**
|
|
116
|
-
* 格式化日期到购物车
|
|
117
|
-
* @param date 开始时间和结束时间
|
|
118
|
-
* @returns 格式化后的日期
|
|
119
|
-
*/
|
|
120
|
-
export declare const formatDateToCartItem: (params: {
|
|
121
|
-
cartItem: CartItem;
|
|
122
|
-
date: {
|
|
123
|
-
startTime: string;
|
|
124
|
-
endTime: string;
|
|
125
|
-
};
|
|
126
|
-
}) => CartItem;
|
|
127
|
-
/**
|
|
128
|
-
* 格式化日期到购物车原始数据
|
|
129
|
-
* @param date 开始时间和结束时间
|
|
130
|
-
* @returns 格式化后的日期原始数据
|
|
131
|
-
*/
|
|
132
|
-
export declare const formatDateToCartItemOrigin: (params: {
|
|
133
|
-
cartItem: CartItem;
|
|
134
|
-
date: {
|
|
135
|
-
startTime: string;
|
|
136
|
-
endTime: string;
|
|
137
|
-
};
|
|
138
|
-
}) => any;
|
|
139
|
-
/**
|
|
140
|
-
* 格式化备注到购物车
|
|
141
|
-
* @param params 参数
|
|
142
|
-
* @returns 格式化后的购物车
|
|
143
|
-
*/
|
|
144
|
-
export declare const formatNoteToCartItem: (params: {
|
|
145
|
-
cartItem: CartItem;
|
|
146
|
-
note: string;
|
|
147
|
-
}) => CartItem;
|
|
148
|
-
/**
|
|
149
|
-
* 格式化备注到购物车原始数据
|
|
150
|
-
* @param params 参数
|
|
151
|
-
* @returns 格式化后的购物车原始数据
|
|
152
|
-
*/
|
|
153
|
-
export declare const formatNoteToCartItemOrigin: (params: {
|
|
154
|
-
cartItem: CartItem;
|
|
155
|
-
note: string;
|
|
156
|
-
}) => any;
|
|
157
|
-
/**
|
|
158
|
-
* 格式化套餐规格信息
|
|
159
|
-
* @param options 套餐规格信息
|
|
160
|
-
* @returns 格式化后的套餐规格信息
|
|
161
|
-
*/
|
|
162
|
-
export declare const formatOptions: (options: any) => any;
|
|
163
|
-
export declare const formatOptionsToOrigin: (options: any) => any;
|
|
164
|
-
/**
|
|
165
|
-
* 格式化商品套餐信息
|
|
166
|
-
* @param bundle 商品套餐信息
|
|
167
|
-
* @returns 格式化后的商品套餐信息
|
|
168
|
-
*/
|
|
169
|
-
export declare const formatBundle: (bundle: any) => any;
|
|
170
|
-
export declare const formatBundleToOrigin: (bundle: any) => any;
|
|
171
|
-
/**
|
|
172
|
-
* 判断是否是普通商品
|
|
173
|
-
* @param product 商品
|
|
174
|
-
* @returns 是否是普通商品
|
|
175
|
-
*/
|
|
176
|
-
export declare const isNormalProduct: (product: any) => boolean;
|
|
177
|
-
/**
|
|
178
|
-
* 获取商品总价
|
|
179
|
-
* @description 当前总价计算基于商品数量为1
|
|
180
|
-
* @param item 商品
|
|
181
|
-
* @returns 商品总价
|
|
182
|
-
*/
|
|
183
|
-
export declare const getProductTotalPrice: (params: {
|
|
184
|
-
product: ProductData;
|
|
185
|
-
bundle?: any;
|
|
186
|
-
options?: any;
|
|
187
|
-
num?: number;
|
|
188
|
-
}) => number;
|
|
189
|
-
/**
|
|
190
|
-
* 获取商品原始总价
|
|
191
|
-
* @description 当前总价计算基于商品数量为1
|
|
192
|
-
* @param item 商品
|
|
193
|
-
* @returns 商品原始总价
|
|
194
|
-
*/
|
|
195
|
-
export declare const getProductOriginTotalPrice: (params: {
|
|
196
|
-
product: ProductData;
|
|
197
|
-
bundle?: any;
|
|
198
|
-
options?: any;
|
|
199
|
-
num?: number;
|
|
200
|
-
}) => number | undefined;
|
|
201
|
-
/**
|
|
202
|
-
* 获取商品定金
|
|
203
|
-
* @description 定金基于商品售价来算,最终乘商品数量
|
|
204
|
-
* 1、如果套餐主商品有定金规则,则定金为:(套餐商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
|
|
205
|
-
* 2、如果套餐主商品没有定金规则,子商品有定金规则,则定金为:(套餐子商品售价 * 套餐子商品定金百分比 + 套餐子商品定金固定金额)* 商品数量,最终将所有子商品定金相加
|
|
206
|
-
* 3、普通商品/单规格商品/组合规则商品,定金规则:(商品总售价 * 定金百分比 + 定金固定金额)* 商品数量
|
|
207
|
-
* @param params 参数
|
|
208
|
-
* @returns 商品定金
|
|
209
|
-
*/
|
|
210
|
-
export declare const getProductDeposit: (params: {
|
|
211
|
-
cartItem: CartItem;
|
|
212
|
-
product: ProductData;
|
|
213
|
-
bundle?: any;
|
|
214
|
-
options?: any;
|
|
215
|
-
num?: number;
|
|
216
|
-
}) => {
|
|
217
|
-
total: number;
|
|
218
|
-
protocols: {
|
|
219
|
-
id: number;
|
|
220
|
-
title: string;
|
|
221
|
-
}[];
|
|
222
|
-
} | null;
|
|
223
|
-
/**
|
|
224
|
-
* 计算商品定金
|
|
225
|
-
* @param params 参数
|
|
226
|
-
* @returns 商品定金
|
|
227
|
-
*/
|
|
228
|
-
export declare const handleProductDeposit: (params: {
|
|
229
|
-
depositData: {
|
|
230
|
-
deposit_fixed?: string;
|
|
231
|
-
deposit_percentage?: string;
|
|
232
|
-
};
|
|
233
|
-
total: string | number;
|
|
234
|
-
num: number;
|
|
235
|
-
}) => {
|
|
236
|
-
result: boolean;
|
|
237
|
-
depositTotal: Decimal;
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* 从购物车中删除资源相关信息
|
|
241
|
-
* @param cartItem 购物车
|
|
242
|
-
* @returns 删除后的购物车
|
|
243
|
-
*/
|
|
244
|
-
export declare const deleteResourceFromCartItem: (cartItem: CartItem) => CartItem;
|
|
245
|
-
/**
|
|
246
|
-
* 从购物车中删除时间
|
|
247
|
-
* @param cartItem 购物车
|
|
248
|
-
* @returns 删除后的购物车
|
|
249
|
-
*/
|
|
250
|
-
export declare const deleteTimeFromCartItem: (cartItem: CartItem) => CartItem;
|
|
251
|
-
/**
|
|
252
|
-
* 从购物车中删除关联表单信息
|
|
253
|
-
* @param cartItem 购物车
|
|
254
|
-
* @returns 删除后的购物车
|
|
255
|
-
*/
|
|
256
|
-
export declare const deleteRelationFormsFromCartItem: (cartItem: CartItem) => CartItem;
|
|
257
|
-
export declare const deleteHolderFromCartItem: (cartItem: CartItem) => CartItem;
|