@pisell/pisellos 2.1.85 → 2.1.86
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +0 -11
- package/dist/modules/Cart/utils/changePrice.js +6 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +2 -1
- package/dist/modules/Discount/types.d.ts +0 -15
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Rules/index.d.ts +2 -7
- package/dist/modules/Rules/index.js +19 -141
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/Summary/index.js +47 -5
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +1 -7
- package/dist/modules/Summary/utils.js +23 -33
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -2
- package/dist/solution/BookingByStep/index.js +84 -35
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +3 -12
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +0 -9
- package/lib/modules/Cart/utils/changePrice.js +5 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +2 -1
- package/lib/modules/Discount/types.d.ts +0 -15
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Rules/index.d.ts +2 -7
- package/lib/modules/Rules/index.js +149 -285
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/Summary/index.js +22 -9
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +1 -7
- package/lib/modules/Summary/utils.js +22 -28
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -2
- package/lib/solution/BookingByStep/index.js +34 -3
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -7
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/package.json +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +0 -3
- package/dist/model/strategy/adapter/index.js +0 -4
- package/dist/model/strategy/adapter/type.d.ts +0 -28
- package/dist/model/strategy/adapter/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -497
- package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/dist/model/strategy/adapter/walletPass/example.js +0 -258
- package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/dist/model/strategy/adapter/walletPass/index.js +0 -182
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -168
- package/dist/model/strategy/adapter/walletPass/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -76
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -1043
- package/dist/model/strategy/index.d.ts +0 -94
- package/dist/model/strategy/index.js +0 -551
- package/dist/model/strategy/strategy-example.d.ts +0 -5
- package/dist/model/strategy/strategy-example.js +0 -331
- package/dist/model/strategy/type.d.ts +0 -228
- package/dist/model/strategy/type.js +0 -94
- package/lib/model/index.d.ts +0 -1
- package/lib/model/index.js +0 -23
- package/lib/model/strategy/adapter/index.d.ts +0 -3
- package/lib/model/strategy/adapter/index.js +0 -45
- package/lib/model/strategy/adapter/type.d.ts +0 -28
- package/lib/model/strategy/adapter/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -421
- package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/lib/model/strategy/adapter/walletPass/example.js +0 -207
- package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/lib/model/strategy/adapter/walletPass/index.js +0 -142
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -168
- package/lib/model/strategy/adapter/walletPass/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -76
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -704
- package/lib/model/strategy/index.d.ts +0 -94
- package/lib/model/strategy/index.js +0 -413
- package/lib/model/strategy/strategy-example.d.ts +0 -5
- package/lib/model/strategy/strategy-example.js +0 -318
- package/lib/model/strategy/type.d.ts +0 -228
- package/lib/model/strategy/type.js +0 -44
|
@@ -16,9 +16,10 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
16
16
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
17
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
18
|
import Decimal from 'decimal.js';
|
|
19
|
-
|
|
19
|
+
import { isNormalProduct } from "../Product/utils";
|
|
20
|
+
import dayjs from 'dayjs';
|
|
21
|
+
export var calculatePriceDetails = function calculatePriceDetails(shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) {
|
|
20
22
|
var subtotal = new Decimal(calculateSubtotal(items));
|
|
21
|
-
var subOriginTotal = new Decimal(calculateOriginSubtotal(items));
|
|
22
23
|
var totalTaxFee = new Decimal(calculateTaxFee(shopInfo, items));
|
|
23
24
|
// 订单附加费列表
|
|
24
25
|
var surcharge = getSurcharge({
|
|
@@ -30,7 +31,7 @@ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, item
|
|
|
30
31
|
isEdit: false,
|
|
31
32
|
isInScheduleByDate: isInScheduleByDate,
|
|
32
33
|
surcharge_list: surchargeList,
|
|
33
|
-
scheduleById:
|
|
34
|
+
scheduleById: scheduleById
|
|
34
35
|
});
|
|
35
36
|
// 订单附加费金额
|
|
36
37
|
var surchargeAmount = new Decimal(getSurchargeAmount({
|
|
@@ -57,15 +58,11 @@ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, item
|
|
|
57
58
|
originTax = _getTax.originTax;
|
|
58
59
|
var total = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
|
|
59
60
|
|
|
60
|
-
// 计算总价 不包含折扣卡商品券折扣信息价格
|
|
61
|
-
var originTotal = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
|
|
62
|
-
|
|
63
61
|
// 计算定金
|
|
64
62
|
var deposit = calculateDeposit(items);
|
|
65
63
|
return {
|
|
66
64
|
subtotal: subtotal.toFixed(2),
|
|
67
65
|
total: total.toFixed(2),
|
|
68
|
-
originTotal: originTotal.toFixed(2),
|
|
69
66
|
taxTitle: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_title,
|
|
70
67
|
taxRate: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_rate,
|
|
71
68
|
totalTaxFee: tax,
|
|
@@ -575,22 +572,6 @@ export var calculateSubtotal = function calculateSubtotal(items) {
|
|
|
575
572
|
return subtotal.toFixed(2);
|
|
576
573
|
};
|
|
577
574
|
|
|
578
|
-
/**
|
|
579
|
-
* 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
|
|
580
|
-
* @param items - 购物车商品数组
|
|
581
|
-
* @returns 商品总价字符串,保留2位小数
|
|
582
|
-
*/
|
|
583
|
-
export var calculateOriginSubtotal = function calculateOriginSubtotal(items) {
|
|
584
|
-
if (!(items !== null && items !== void 0 && items.length)) {
|
|
585
|
-
return '0.00';
|
|
586
|
-
}
|
|
587
|
-
var subtotal = items.reduce(function (sum, item) {
|
|
588
|
-
var cartItemTotalPrice = new Decimal(item.summaryOriginTotal || 0);
|
|
589
|
-
return sum.plus(cartItemTotalPrice);
|
|
590
|
-
}, new Decimal(0));
|
|
591
|
-
return subtotal.toFixed(2);
|
|
592
|
-
};
|
|
593
|
-
|
|
594
575
|
/**
|
|
595
576
|
* @title: 单个商品的税费
|
|
596
577
|
* @description:
|
|
@@ -736,12 +717,8 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
736
717
|
var bundleItem = _step4.value;
|
|
737
718
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
738
719
|
var _ref10, _bundleItem$bundle_se2;
|
|
739
|
-
//
|
|
740
|
-
var
|
|
741
|
-
// 子商品价格
|
|
742
|
-
var bundleItemPrice = new Decimal((_ref10 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
743
|
-
// todo: 套餐子商品后不需要处理 子商品价格 - 子商品折扣金额
|
|
744
|
-
var bundleItemTotal = bundleItemPrice.minus(discountAmount);
|
|
720
|
+
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
721
|
+
var bundleItemTotal = new Decimal((_ref10 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
745
722
|
total = total.add(bundleItemTotal);
|
|
746
723
|
}
|
|
747
724
|
}
|
|
@@ -862,6 +839,7 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
862
839
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
863
840
|
*/
|
|
864
841
|
export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
842
|
+
var _service$filter;
|
|
865
843
|
var service = _ref11.service,
|
|
866
844
|
addons = _ref11.addons,
|
|
867
845
|
bookingDetail = _ref11.bookingDetail,
|
|
@@ -870,6 +848,16 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
870
848
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
871
849
|
surcharge_list = options.surcharge_list,
|
|
872
850
|
scheduleById = options.scheduleById;
|
|
851
|
+
// 在所有商品里试着找 start_date,如果没有则用当前时间
|
|
852
|
+
var firstAppointmentCartItem = (_service$filter = service.filter(function (n) {
|
|
853
|
+
return !isNormalProduct(n._productOrigin);
|
|
854
|
+
})) === null || _service$filter === void 0 ? void 0 : _service$filter[0];
|
|
855
|
+
var startDate = '';
|
|
856
|
+
if (firstAppointmentCartItem) {
|
|
857
|
+
startDate = firstAppointmentCartItem.start_date + ' ' + firstAppointmentCartItem.start_time + ':00';
|
|
858
|
+
} else {
|
|
859
|
+
startDate = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
860
|
+
}
|
|
873
861
|
// 编辑状态, 且未修改商品时直接从详情取出
|
|
874
862
|
if (!isEdit && bookingId) {
|
|
875
863
|
if (Array.isArray(bookingDetail === null || bookingDetail === void 0 ? void 0 : bookingDetail.surcharge)) {
|
|
@@ -936,7 +924,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
936
924
|
// 主商品符合附加费条件
|
|
937
925
|
if (isProductMatchSurchargeCondition({
|
|
938
926
|
isCustomItem: item.isCustomItem,
|
|
939
|
-
startDate:
|
|
927
|
+
startDate: startDate,
|
|
940
928
|
product_id: item.id
|
|
941
929
|
}, {
|
|
942
930
|
surchargeConfig: surchargeConfig,
|
|
@@ -970,7 +958,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
970
958
|
// bundle商品是原价且符合附加费条件
|
|
971
959
|
if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition({
|
|
972
960
|
isCustomItem: false,
|
|
973
|
-
startDate:
|
|
961
|
+
startDate: startDate,
|
|
974
962
|
product_id: bundleItem._bundle_product_id
|
|
975
963
|
}, {
|
|
976
964
|
surchargeConfig: surchargeConfig,
|
|
@@ -1002,7 +990,7 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1002
990
|
var relationDetail = _step7.value;
|
|
1003
991
|
if (isProductMatchSurchargeCondition({
|
|
1004
992
|
isCustomItem: false,
|
|
1005
|
-
startDate:
|
|
993
|
+
startDate: startDate,
|
|
1006
994
|
product_id: relationDetail.product_id
|
|
1007
995
|
}, {
|
|
1008
996
|
surchargeConfig: surchargeConfig,
|
|
@@ -1039,7 +1027,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1039
1027
|
try {
|
|
1040
1028
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
1041
1029
|
var _item = _step8.value;
|
|
1042
|
-
if (isProductMatchSurchargeCondition(_item, {
|
|
1030
|
+
if (isProductMatchSurchargeCondition(_objectSpread(_objectSpread({}, _item), {}, {
|
|
1031
|
+
startDate: startDate
|
|
1032
|
+
}), {
|
|
1043
1033
|
surchargeConfig: surchargeConfig,
|
|
1044
1034
|
scheduleById: scheduleById || {},
|
|
1045
1035
|
isInScheduleByDate: isInScheduleByDate
|
package/dist/plugins/window.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WalletPassEvaluator } from '../model';
|
|
2
1
|
import { Plugin } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* WindowPlugin 接口定义
|
|
@@ -15,7 +14,6 @@ export interface WindowPlugin extends Plugin {
|
|
|
15
14
|
document: Partial<Document>;
|
|
16
15
|
history: History;
|
|
17
16
|
interaction?: any;
|
|
18
|
-
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* 简单的 Storage 接口实现
|
|
@@ -144,7 +144,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
144
144
|
getSummary(): Promise<{
|
|
145
145
|
subtotal: string | number;
|
|
146
146
|
total: string | number;
|
|
147
|
-
originTotal: string | number;
|
|
148
147
|
taxTitle?: string | undefined;
|
|
149
148
|
totalTaxFee?: string | number | undefined;
|
|
150
149
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -311,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
310
|
date: string;
|
|
312
311
|
status: string;
|
|
313
312
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
315
314
|
}[]>;
|
|
316
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
316
|
private getScheduleDataByIds;
|
|
@@ -2552,14 +2552,63 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2552
2552
|
var targetResourceTimes = allResources === null || allResources === void 0 || (_allResources$find = allResources.find(function (n) {
|
|
2553
2553
|
return n.id === resource.id;
|
|
2554
2554
|
})) === null || _allResources$find === void 0 ? void 0 : _allResources$find.times;
|
|
2555
|
+
// 找到最晚的 end_at 还没用,因为可能存在资源工作时间是 10:00-19:00,但是资源的 times 里有 16:30-19:00 被 block 的情况
|
|
2556
|
+
// 所以还需要排除掉 block 时间
|
|
2557
|
+
function getEarliestBlockedStartTime(_ref11) {
|
|
2558
|
+
var _earliestBlockStart;
|
|
2559
|
+
var currentStartTime = _ref11.currentStartTime,
|
|
2560
|
+
times = _ref11.times;
|
|
2561
|
+
var currentStart = dayjs(currentStartTime);
|
|
2562
|
+
var earliestBlockStart;
|
|
2563
|
+
var _iterator3 = _createForOfIteratorHelper(times || []),
|
|
2564
|
+
_step3;
|
|
2565
|
+
try {
|
|
2566
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2567
|
+
var time = _step3.value;
|
|
2568
|
+
var _iterator4 = _createForOfIteratorHelper(time.event_list || []),
|
|
2569
|
+
_step4;
|
|
2570
|
+
try {
|
|
2571
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2572
|
+
var event = _step4.value;
|
|
2573
|
+
var eventStart = dayjs(event.start_at);
|
|
2574
|
+
var eventEnd = dayjs(event.end_at);
|
|
2575
|
+
if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
|
|
2576
|
+
return currentStart.format('YYYY-MM-DD HH:mm');
|
|
2577
|
+
}
|
|
2578
|
+
if (eventStart.isAfter(currentStart)) {
|
|
2579
|
+
if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
|
|
2580
|
+
earliestBlockStart = eventStart;
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
} catch (err) {
|
|
2585
|
+
_iterator4.e(err);
|
|
2586
|
+
} finally {
|
|
2587
|
+
_iterator4.f();
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
} catch (err) {
|
|
2591
|
+
_iterator3.e(err);
|
|
2592
|
+
} finally {
|
|
2593
|
+
_iterator3.f();
|
|
2594
|
+
}
|
|
2595
|
+
return (_earliestBlockStart = earliestBlockStart) === null || _earliestBlockStart === void 0 ? void 0 : _earliestBlockStart.format('YYYY-MM-DD HH:mm');
|
|
2596
|
+
}
|
|
2555
2597
|
var resourcesEndTime = targetResourceTimes.reduce(function (acc, curr) {
|
|
2556
2598
|
return dayjs(curr.end_at).isAfter(dayjs(acc.end_at)) ? curr : acc;
|
|
2557
2599
|
}, targetResourceTimes[0]);
|
|
2600
|
+
var earliestBlockedStartTime = getEarliestBlockedStartTime({
|
|
2601
|
+
currentStartTime: currentStartTime,
|
|
2602
|
+
times: targetResourceTimes
|
|
2603
|
+
});
|
|
2558
2604
|
|
|
2559
2605
|
// 将 operating_day_boundary 转换为与 resourcesEndTime.end_at 相同日期的完整日期时间
|
|
2560
2606
|
var resourceDate = dayjs(resourcesEndTime.end_at).format('YYYY-MM-DD');
|
|
2561
2607
|
var operatingBoundaryDateTime = "".concat(resourceDate, " ").concat(operating_day_boundary.type === 'start_time' ? '23:59' : operating_day_boundary.time);
|
|
2562
|
-
var
|
|
2608
|
+
var endTimeCandidates = [resourcesEndTime.end_at, operatingBoundaryDateTime].concat(_toConsumableArray(earliestBlockedStartTime ? [earliestBlockedStartTime] : []));
|
|
2609
|
+
var endTime = endTimeCandidates.reduce(function (earliest, value) {
|
|
2610
|
+
return dayjs(value).isBefore(dayjs(earliest)) ? value : earliest;
|
|
2611
|
+
}, endTimeCandidates[0]);
|
|
2563
2612
|
// 修复:如果 endTime 只是时间格式(如 "17:00"),需要加上日期
|
|
2564
2613
|
var formattedEndTime;
|
|
2565
2614
|
if (typeof endTime === 'string' && endTime.includes(':') && !endTime.includes(' ') && !endTime.includes('T')) {
|
|
@@ -2700,14 +2749,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2700
2749
|
// 通过商品和 schedule 来获取视频可用的时间片、时间片内资源可用的数据
|
|
2701
2750
|
}, {
|
|
2702
2751
|
key: "getTimeslotBySchedule",
|
|
2703
|
-
value: function getTimeslotBySchedule(
|
|
2752
|
+
value: function getTimeslotBySchedule(_ref12) {
|
|
2704
2753
|
var _this$store$currentPr2,
|
|
2705
2754
|
_targetProductData$pr,
|
|
2706
2755
|
_this15 = this;
|
|
2707
|
-
var date =
|
|
2708
|
-
scheduleIds =
|
|
2709
|
-
resources =
|
|
2710
|
-
product =
|
|
2756
|
+
var date = _ref12.date,
|
|
2757
|
+
scheduleIds = _ref12.scheduleIds,
|
|
2758
|
+
resources = _ref12.resources,
|
|
2759
|
+
product = _ref12.product;
|
|
2711
2760
|
var targetProduct = this.store.currentProduct;
|
|
2712
2761
|
// 如果外面传递了product 优先用外面的
|
|
2713
2762
|
var targetProductData = product || targetProduct;
|
|
@@ -3266,12 +3315,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3266
3315
|
// 检查资源类型(单个预约 vs 多个预约)
|
|
3267
3316
|
// 从商品配置中获取资源类型信息
|
|
3268
3317
|
var resourceTypeConfig = null;
|
|
3269
|
-
var
|
|
3270
|
-
|
|
3318
|
+
var _iterator5 = _createForOfIteratorHelper(items),
|
|
3319
|
+
_step5;
|
|
3271
3320
|
try {
|
|
3272
|
-
for (
|
|
3321
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
3273
3322
|
var _cartItem$_productOri12;
|
|
3274
|
-
var cartItem =
|
|
3323
|
+
var cartItem = _step5.value;
|
|
3275
3324
|
if ((_cartItem$_productOri12 = cartItem._productOrigin) !== null && _cartItem$_productOri12 !== void 0 && (_cartItem$_productOri12 = _cartItem$_productOri12.product_resource) !== null && _cartItem$_productOri12 !== void 0 && _cartItem$_productOri12.resources) {
|
|
3276
3325
|
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
3277
3326
|
return r.code === resourceCode && r.status === 1;
|
|
@@ -3280,9 +3329,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3280
3329
|
}
|
|
3281
3330
|
}
|
|
3282
3331
|
} catch (err) {
|
|
3283
|
-
|
|
3332
|
+
_iterator5.e(err);
|
|
3284
3333
|
} finally {
|
|
3285
|
-
|
|
3334
|
+
_iterator5.f();
|
|
3286
3335
|
}
|
|
3287
3336
|
var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
|
|
3288
3337
|
var totalAvailable;
|
|
@@ -3485,17 +3534,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3485
3534
|
*/
|
|
3486
3535
|
}, {
|
|
3487
3536
|
key: "convertProductToCartItem",
|
|
3488
|
-
value: function convertProductToCartItem(
|
|
3489
|
-
var product =
|
|
3490
|
-
date =
|
|
3491
|
-
account =
|
|
3492
|
-
var
|
|
3493
|
-
bundle =
|
|
3494
|
-
options =
|
|
3495
|
-
origin =
|
|
3496
|
-
product_variant_id =
|
|
3497
|
-
|
|
3498
|
-
quantity =
|
|
3537
|
+
value: function convertProductToCartItem(_ref13) {
|
|
3538
|
+
var product = _ref13.product,
|
|
3539
|
+
date = _ref13.date,
|
|
3540
|
+
account = _ref13.account;
|
|
3541
|
+
var _ref14 = product || {},
|
|
3542
|
+
bundle = _ref14.bundle,
|
|
3543
|
+
options = _ref14.options,
|
|
3544
|
+
origin = _ref14.origin,
|
|
3545
|
+
product_variant_id = _ref14.product_variant_id,
|
|
3546
|
+
_ref14$quantity = _ref14.quantity,
|
|
3547
|
+
quantity = _ref14$quantity === void 0 ? 1 : _ref14$quantity;
|
|
3499
3548
|
|
|
3500
3549
|
// 处理商品数据,类似 addProductToCart 中的逻辑
|
|
3501
3550
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
@@ -3550,11 +3599,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3550
3599
|
}
|
|
3551
3600
|
}, {
|
|
3552
3601
|
key: "checkMaxDurationCapacityForDetailNums",
|
|
3553
|
-
value: function checkMaxDurationCapacityForDetailNums(
|
|
3602
|
+
value: function checkMaxDurationCapacityForDetailNums(_ref15) {
|
|
3554
3603
|
var _this17 = this;
|
|
3555
|
-
var product =
|
|
3556
|
-
date =
|
|
3557
|
-
account =
|
|
3604
|
+
var product = _ref15.product,
|
|
3605
|
+
date = _ref15.date,
|
|
3606
|
+
account = _ref15.account;
|
|
3558
3607
|
var cartItems = this.store.cart.getItems().filter(function (item) {
|
|
3559
3608
|
return !isNormalProduct(item._productOrigin);
|
|
3560
3609
|
});
|
|
@@ -3699,12 +3748,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3699
3748
|
// 检查资源类型(单个预约 vs 多个预约)
|
|
3700
3749
|
// 从商品配置中获取资源类型信息
|
|
3701
3750
|
var resourceTypeConfig = null;
|
|
3702
|
-
var
|
|
3703
|
-
|
|
3751
|
+
var _iterator6 = _createForOfIteratorHelper(items),
|
|
3752
|
+
_step6;
|
|
3704
3753
|
try {
|
|
3705
|
-
for (
|
|
3754
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
3706
3755
|
var _cartItem$_productOri15;
|
|
3707
|
-
var cartItem =
|
|
3756
|
+
var cartItem = _step6.value;
|
|
3708
3757
|
if ((_cartItem$_productOri15 = cartItem._productOrigin) !== null && _cartItem$_productOri15 !== void 0 && (_cartItem$_productOri15 = _cartItem$_productOri15.product_resource) !== null && _cartItem$_productOri15 !== void 0 && _cartItem$_productOri15.resources) {
|
|
3709
3758
|
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
3710
3759
|
return r.code === resourceCode && r.status === 1;
|
|
@@ -3713,9 +3762,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3713
3762
|
}
|
|
3714
3763
|
}
|
|
3715
3764
|
} catch (err) {
|
|
3716
|
-
|
|
3765
|
+
_iterator6.e(err);
|
|
3717
3766
|
} finally {
|
|
3718
|
-
|
|
3767
|
+
_iterator6.f();
|
|
3719
3768
|
}
|
|
3720
3769
|
var isMultipleBooking = ((_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type) === 'multiple';
|
|
3721
3770
|
var totalAvailable;
|
|
@@ -4086,12 +4135,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4086
4135
|
}, {
|
|
4087
4136
|
key: "getTimeslotsScheduleByDateRange",
|
|
4088
4137
|
value: (function () {
|
|
4089
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(
|
|
4138
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref16) {
|
|
4090
4139
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4091
4140
|
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4092
4141
|
while (1) switch (_context28.prev = _context28.next) {
|
|
4093
4142
|
case 0:
|
|
4094
|
-
startDate =
|
|
4143
|
+
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4095
4144
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
4096
4145
|
startDate: startDate,
|
|
4097
4146
|
endDate: endDate,
|
|
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
115
115
|
* 获取当前的客户搜索条件
|
|
116
116
|
* @returns 当前搜索条件
|
|
117
117
|
*/
|
|
118
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
118
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
119
119
|
/**
|
|
120
120
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
121
121
|
* @returns 客户状态
|
|
@@ -403,7 +403,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
403
403
|
product_id: item.product_id,
|
|
404
404
|
product_variant_id: item.product_variant_id,
|
|
405
405
|
quantity: item.num,
|
|
406
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
407
406
|
// 商品是否含税:1;0
|
|
408
407
|
is_charge_tax: (_item$is_charge_tax = item.is_charge_tax) !== null && _item$is_charge_tax !== void 0 ? _item$is_charge_tax : 0,
|
|
409
408
|
// 若商品不含税,计算得到的税费,单位(元)
|
|
@@ -428,7 +427,6 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
428
427
|
},
|
|
429
428
|
product_bundle: item.product_bundle.map(function (bundle) {
|
|
430
429
|
return {
|
|
431
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
432
430
|
bundle_id: bundle.bundle_id,
|
|
433
431
|
bundle_product_id: bundle.bundle_product_id,
|
|
434
432
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
@@ -22,7 +22,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
22
22
|
getCurrentBookingTime(): string | null;
|
|
23
23
|
private filterDiscountListByBookingTime;
|
|
24
24
|
setCustomer(customer: Customer): Promise<void>;
|
|
25
|
-
setOriginTotalAmount(amount: number): void;
|
|
26
25
|
setHolders(holders: {
|
|
27
26
|
form_record_id: number;
|
|
28
27
|
}[]): void;
|
|
@@ -56,7 +56,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
56
56
|
originalDiscountList: [],
|
|
57
57
|
currentBookingTime: "",
|
|
58
58
|
filteredDiscountList: [],
|
|
59
|
-
orderTotalAmount: 0,
|
|
60
59
|
bookingSubject: undefined
|
|
61
60
|
};
|
|
62
61
|
return _this;
|
|
@@ -289,14 +288,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
289
288
|
return _setCustomer.apply(this, arguments);
|
|
290
289
|
}
|
|
291
290
|
return setCustomer;
|
|
292
|
-
}()
|
|
293
|
-
}, {
|
|
294
|
-
key: "setOriginTotalAmount",
|
|
295
|
-
value: function setOriginTotalAmount(amount) {
|
|
296
|
-
this.store.orderTotalAmount = amount;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// 设置holders
|
|
291
|
+
}() // 设置holders
|
|
300
292
|
}, {
|
|
301
293
|
key: "setHolders",
|
|
302
294
|
value: function setHolders(holders) {
|
|
@@ -325,7 +317,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
325
317
|
productList: productList,
|
|
326
318
|
discountList: this.getDiscountList(),
|
|
327
319
|
holders: this.store.holders || [],
|
|
328
|
-
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
329
320
|
isFormSubject: ((_this$store$bookingSu = this.store.bookingSubject) === null || _this$store$bookingSu === void 0 ? void 0 : _this$store$bookingSu.type) === 'form'
|
|
330
321
|
}, options) || {
|
|
331
322
|
productList: productList,
|
|
@@ -467,7 +458,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
467
458
|
oldDiscountList: this.getDiscountList(),
|
|
468
459
|
newDiscountList: withScanList,
|
|
469
460
|
holders: this.store.holders || [],
|
|
470
|
-
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
471
461
|
isFormSubject: ((_this$store$bookingSu2 = this.store.bookingSubject) === null || _this$store$bookingSu2 === void 0 ? void 0 : _this$store$bookingSu2.type) === 'form'
|
|
472
462
|
}) || {
|
|
473
463
|
isAvailable: false,
|
|
@@ -755,7 +745,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
755
745
|
action: 'create',
|
|
756
746
|
with_good_pass: 1,
|
|
757
747
|
with_discount_card: 1,
|
|
758
|
-
with_wallet_pass_holder: 1
|
|
748
|
+
with_wallet_pass_holder: 1,
|
|
749
|
+
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
759
750
|
});
|
|
760
751
|
case 4:
|
|
761
752
|
goodPassList = _context9.sent;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -38,7 +38,6 @@ __reExport(src_exports, require("./types"), module.exports);
|
|
|
38
38
|
__reExport(src_exports, require("./modules"), module.exports);
|
|
39
39
|
__reExport(src_exports, require("./plugins"), module.exports);
|
|
40
40
|
__reExport(src_exports, require("./solution"), module.exports);
|
|
41
|
-
__reExport(src_exports, require("./model"), module.exports);
|
|
42
41
|
var import_core = require("./core");
|
|
43
42
|
var import_core2 = __toESM(require("./core"));
|
|
44
43
|
var src_default = import_core2.default;
|
|
@@ -48,6 +47,5 @@ var src_default = import_core2.default;
|
|
|
48
47
|
...require("./types"),
|
|
49
48
|
...require("./modules"),
|
|
50
49
|
...require("./plugins"),
|
|
51
|
-
...require("./solution")
|
|
52
|
-
...require("./model")
|
|
50
|
+
...require("./solution")
|
|
53
51
|
});
|
|
@@ -90,14 +90,6 @@ var formatProductToCartItem = (params) => {
|
|
|
90
90
|
num,
|
|
91
91
|
discounts
|
|
92
92
|
});
|
|
93
|
-
const origin_total = getProductTotalPrice({
|
|
94
|
-
product: cartItem._productInit || cartItem._productOrigin,
|
|
95
|
-
bundle,
|
|
96
|
-
options,
|
|
97
|
-
num,
|
|
98
|
-
discounts: []
|
|
99
|
-
});
|
|
100
|
-
cartItem.summaryOriginTotal = (origin_total || 0) * (num || 1);
|
|
101
93
|
cartItem.image = product == null ? void 0 : product.cover;
|
|
102
94
|
cartItem.like_status = "common";
|
|
103
95
|
cartItem.duration = product == null ? void 0 : product.duration;
|
|
@@ -199,7 +191,6 @@ var getProductTotalPrice = (params) => {
|
|
|
199
191
|
amount: currentValue.amount,
|
|
200
192
|
tag: currentValue.type,
|
|
201
193
|
par_value: currentValue.discount.percent,
|
|
202
|
-
config: currentValue.config,
|
|
203
194
|
metadata: {
|
|
204
195
|
discount_card_type: (_a = currentValue == null ? void 0 : currentValue.discount) == null ? void 0 : _a.discount_card_type
|
|
205
196
|
}
|
|
@@ -60,6 +60,11 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
|
|
|
60
60
|
if (targetBundleItem.price_type === "markdown") {
|
|
61
61
|
targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).mul(-1).toNumber();
|
|
62
62
|
}
|
|
63
|
+
if (n.option) {
|
|
64
|
+
targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).add(n.option.reduce((pre, cur) => {
|
|
65
|
+
return pre + new import_decimal.default(cur.price || 0).mul(cur.num || 1).toNumber();
|
|
66
|
+
}, 0)).toNumber();
|
|
67
|
+
}
|
|
63
68
|
if (targetBundleItem) {
|
|
64
69
|
return {
|
|
65
70
|
...n,
|
|
@@ -22,6 +22,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
22
22
|
with_discount_card: 0 | 1;
|
|
23
23
|
customer_id: number;
|
|
24
24
|
with_wallet_pass_holder: 0 | 1;
|
|
25
|
+
request_timezone: string;
|
|
25
26
|
}): Promise<Discount[]>;
|
|
26
27
|
batchSearch(code: string, customerId?: number): Promise<Discount[]>;
|
|
27
28
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
@@ -111,7 +111,8 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
111
111
|
relation_product: 1,
|
|
112
112
|
with: ["extensionData", "customScheduleSnapshot", "holder.detail"],
|
|
113
113
|
order_behavior_count: 1,
|
|
114
|
-
order_behavior_count_customer_id: customerId || 1
|
|
114
|
+
order_behavior_count_customer_id: customerId || 1,
|
|
115
|
+
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
115
116
|
});
|
|
116
117
|
const resultDiscountList = this.filterEnabledDiscountList((result == null ? void 0 : result.data) || []) || [];
|
|
117
118
|
return resultDiscountList;
|
|
@@ -25,8 +25,6 @@ interface Limitedrelationproductdata {
|
|
|
25
25
|
product_ids: number[];
|
|
26
26
|
product_collection_id: number[];
|
|
27
27
|
package_sub_item_usage_rules?: PackageSubItemUsageRules;
|
|
28
|
-
filter: 0 | 1;
|
|
29
|
-
exclude_product_ids: number[];
|
|
30
28
|
}
|
|
31
29
|
interface ApplicableProductDetails {
|
|
32
30
|
amount: string;
|
|
@@ -107,19 +105,6 @@ export interface Discount {
|
|
|
107
105
|
isSelected?: boolean;
|
|
108
106
|
isAvailable?: boolean;
|
|
109
107
|
isUsed?: boolean;
|
|
110
|
-
config?: {
|
|
111
|
-
isAvailable?: boolean;
|
|
112
|
-
/** 最大抵扣金额 */
|
|
113
|
-
maxDeductionAmount?: number;
|
|
114
|
-
/** 每单最多使用张数 */
|
|
115
|
-
maxUsagePerOrder?: number;
|
|
116
|
-
/** 是否抵扣税费与附加费 */
|
|
117
|
-
deductTaxAndFee?: boolean;
|
|
118
|
-
/** 适用粒度(多商品共用) */
|
|
119
|
-
allowCrossProduct?: boolean;
|
|
120
|
-
/** 可用商品数量上限 */
|
|
121
|
-
applicableProductLimit?: number;
|
|
122
|
-
};
|
|
123
108
|
applicableProductIds?: number[];
|
|
124
109
|
applicableProductDetails: ApplicableProductDetails[];
|
|
125
110
|
appliedProductDetails: ApplicableProductDetails[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
-
import { RequestPlugin
|
|
2
|
+
import { RequestPlugin } from '../../plugins';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
4
|
import { PaymentModuleAPI, PaymentMethod, PaymentOrder, PaymentItem, PaymentItemInput, PaymentUpdateFields, PushOrderParams, CashPayment, EftposPayment, WalletPassPayment, RoundingRule, RoundingInterval, RoundingResult } from './types';
|
|
5
5
|
export * from './types';
|
|
@@ -21,7 +21,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
21
21
|
request: RequestPlugin;
|
|
22
22
|
private app;
|
|
23
23
|
private store;
|
|
24
|
-
window: WindowPlugin;
|
|
25
24
|
private dbManager;
|
|
26
25
|
private logger;
|
|
27
26
|
protected otherParams: any;
|
|
@@ -70,7 +70,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
70
70
|
this.otherParams = options.otherParams || {};
|
|
71
71
|
this.request = core.getPlugin("request");
|
|
72
72
|
const appPlugin = core.getPlugin("app");
|
|
73
|
-
this.window = core.getPlugin("window");
|
|
74
73
|
if (!this.request) {
|
|
75
74
|
throw new Error("支付模块需要 request 插件支持");
|
|
76
75
|
}
|
|
@@ -25,9 +25,6 @@ __export(utils_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(utils_exports);
|
|
27
27
|
var getAvailableMaxAmount = (data) => {
|
|
28
|
-
if (typeof data._available_max_amount === "number") {
|
|
29
|
-
return data._available_max_amount;
|
|
30
|
-
}
|
|
31
28
|
return data.tag !== "point_card" ? data.available_max_amount : data == null ? void 0 : data.recommended_usage_amount;
|
|
32
29
|
};
|
|
33
30
|
var formatWalletPassList2PreparePayments = (list) => {
|