@pisell/pisellos 1.0.65 → 1.0.67
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/Date/index.js +4 -0
- package/dist/modules/Order/index.js +10 -4
- package/dist/modules/Payment/index.d.ts +1 -0
- package/dist/modules/Payment/index.js +75 -41
- package/dist/modules/Payment/walletpass.js +3 -4
- package/dist/modules/Rules/index.js +2 -0
- package/dist/modules/Schedule/index.d.ts +1 -1
- package/dist/modules/Schedule/index.js +9 -0
- package/dist/solution/BookingByStep/index.d.ts +16 -4
- package/dist/solution/BookingByStep/index.js +671 -109
- package/dist/solution/BookingByStep/utils/capacity.d.ts +23 -0
- package/dist/solution/BookingByStep/utils/capacity.js +219 -1
- package/dist/solution/BookingByStep/utils/stock.d.ts +29 -0
- package/dist/solution/BookingByStep/utils/stock.js +126 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +6 -148
- package/dist/solution/Checkout/index.js +1188 -2434
- package/dist/solution/Checkout/types.d.ts +7 -220
- package/dist/solution/Checkout/types.js +1 -49
- package/dist/solution/Checkout/utils/index.d.ts +9 -5
- package/dist/solution/Checkout/utils/index.js +18 -56
- package/lib/modules/Date/index.js +3 -0
- package/lib/modules/Order/index.js +6 -0
- package/lib/modules/Payment/index.d.ts +1 -0
- package/lib/modules/Payment/index.js +35 -8
- package/lib/modules/Payment/walletpass.js +2 -2
- package/lib/modules/Rules/index.js +2 -0
- package/lib/modules/Schedule/index.d.ts +1 -1
- package/lib/modules/Schedule/index.js +9 -0
- package/lib/solution/BookingByStep/index.d.ts +16 -4
- package/lib/solution/BookingByStep/index.js +363 -8
- package/lib/solution/BookingByStep/utils/capacity.d.ts +23 -0
- package/lib/solution/BookingByStep/utils/capacity.js +157 -0
- package/lib/solution/BookingByStep/utils/stock.d.ts +29 -0
- package/lib/solution/BookingByStep/utils/stock.js +89 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +6 -148
- package/lib/solution/Checkout/index.js +337 -1115
- package/lib/solution/Checkout/types.d.ts +7 -220
- package/lib/solution/Checkout/types.js +3 -27
- package/lib/solution/Checkout/utils/index.d.ts +9 -5
- package/lib/solution/Checkout/utils/index.js +12 -53
- package/package.json +1 -1
|
@@ -267,6 +267,10 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
267
267
|
if (!resource.times || !Array.isArray(resource.times) || !resource.start_time) {
|
|
268
268
|
return resource;
|
|
269
269
|
}
|
|
270
|
+
// 如果resource.advanced 为 null 或者 resource.advanced.unit 为 0,则不进行修正
|
|
271
|
+
if (!resource.advanced || resource.advanced.unit === 0) {
|
|
272
|
+
return resource;
|
|
273
|
+
}
|
|
270
274
|
var resourceStartTime = dayjs(resource.start_time);
|
|
271
275
|
|
|
272
276
|
// 过滤和修正时间段
|
|
@@ -354,21 +354,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
354
354
|
return this.request.post('/order/checkout', orderData);
|
|
355
355
|
case 11:
|
|
356
356
|
response = _context3.sent;
|
|
357
|
+
this.logInfo('Order API called successfully', {
|
|
358
|
+
response: response
|
|
359
|
+
});
|
|
357
360
|
console.log('[Order] 订单创建成功,后端响应:', {
|
|
358
361
|
success: !!response,
|
|
359
362
|
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
360
363
|
});
|
|
361
364
|
return _context3.abrupt("return", response);
|
|
362
|
-
case
|
|
363
|
-
_context3.prev =
|
|
365
|
+
case 17:
|
|
366
|
+
_context3.prev = 17;
|
|
364
367
|
_context3.t0 = _context3["catch"](2);
|
|
365
368
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
|
|
369
|
+
this.logInfo('Order API called failed', {
|
|
370
|
+
error: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
|
|
371
|
+
});
|
|
366
372
|
throw _context3.t0;
|
|
367
|
-
case
|
|
373
|
+
case 22:
|
|
368
374
|
case "end":
|
|
369
375
|
return _context3.stop();
|
|
370
376
|
}
|
|
371
|
-
}, _callee3, this, [[2,
|
|
377
|
+
}, _callee3, this, [[2, 17]]);
|
|
372
378
|
}));
|
|
373
379
|
function createOrderByCheckout(_x4) {
|
|
374
380
|
return _createOrderByCheckout.apply(this, arguments);
|
|
@@ -85,6 +85,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
85
85
|
// IndexDBManager 实例
|
|
86
86
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
87
87
|
// LoggerManager 实例
|
|
88
|
+
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
88
89
|
// 支付方式实例
|
|
89
90
|
_defineProperty(_assertThisInitialized(_this), "cash", void 0);
|
|
90
91
|
_defineProperty(_assertThisInitialized(_this), "eftpos", void 0);
|
|
@@ -104,34 +105,35 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
104
105
|
case 0:
|
|
105
106
|
this.core = core;
|
|
106
107
|
this.store = options.store;
|
|
108
|
+
this.otherParams = options.otherParams || {};
|
|
107
109
|
|
|
108
110
|
// 获取依赖的插件
|
|
109
111
|
this.request = core.getPlugin('request');
|
|
110
112
|
appPlugin = core.getPlugin('app');
|
|
111
113
|
if (this.request) {
|
|
112
|
-
_context.next =
|
|
114
|
+
_context.next = 7;
|
|
113
115
|
break;
|
|
114
116
|
}
|
|
115
117
|
throw new Error('支付模块需要 request 插件支持');
|
|
116
|
-
case
|
|
118
|
+
case 7:
|
|
117
119
|
if (appPlugin) {
|
|
118
|
-
_context.next =
|
|
120
|
+
_context.next = 9;
|
|
119
121
|
break;
|
|
120
122
|
}
|
|
121
123
|
throw new Error('支付模块需要 app 插件支持');
|
|
122
|
-
case
|
|
124
|
+
case 9:
|
|
123
125
|
this.app = appPlugin.getApp();
|
|
124
126
|
this.dbManager = this.app.dbManager;
|
|
125
127
|
this.logger = this.app.logger;
|
|
126
128
|
|
|
127
129
|
// 确保支付模块所需的对象存储已创建
|
|
128
|
-
_context.next =
|
|
130
|
+
_context.next = 14;
|
|
129
131
|
return this.ensurePaymentTables();
|
|
130
|
-
case
|
|
132
|
+
case 14:
|
|
131
133
|
this.registerNetworkHandlers();
|
|
132
134
|
console.log('[PaymentModule] 初始化完成');
|
|
133
135
|
this.logInfo('PaymentModule initialized successfully');
|
|
134
|
-
case
|
|
136
|
+
case 17:
|
|
135
137
|
case "end":
|
|
136
138
|
return _context.stop();
|
|
137
139
|
}
|
|
@@ -148,6 +150,15 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
148
150
|
}, {
|
|
149
151
|
key: "logInfo",
|
|
150
152
|
value: function logInfo(title, metadata) {
|
|
153
|
+
var _this$otherParams;
|
|
154
|
+
if ((_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.fatherModule) {
|
|
155
|
+
var _this$otherParams2;
|
|
156
|
+
var fatherModule = this.core.getModule((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.fatherModule);
|
|
157
|
+
if (fatherModule) {
|
|
158
|
+
fatherModule.logInfo("".concat(title), metadata);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
151
162
|
if (this.logger) {
|
|
152
163
|
this.logger.addLog({
|
|
153
164
|
type: 'info',
|
|
@@ -646,7 +657,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
646
657
|
key: "createPaymentOrderAsync",
|
|
647
658
|
value: (function () {
|
|
648
659
|
var _createPaymentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
649
|
-
var
|
|
660
|
+
var existingOrder, newOrder;
|
|
650
661
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
651
662
|
while (1) switch (_context7.prev = _context7.next) {
|
|
652
663
|
case 0:
|
|
@@ -656,19 +667,23 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
656
667
|
});
|
|
657
668
|
_context7.prev = 1;
|
|
658
669
|
_context7.next = 4;
|
|
659
|
-
return this.dbManager.
|
|
670
|
+
return this.dbManager.get('order', params.order_id);
|
|
660
671
|
case 4:
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
672
|
+
existingOrder = _context7.sent;
|
|
673
|
+
this.logInfo('createPaymentOrderAsync existingOrder', {
|
|
674
|
+
existingOrder: existingOrder
|
|
664
675
|
});
|
|
676
|
+
// const existingOrder = existingOrders.find(
|
|
677
|
+
// (order: PaymentOrder) => String(order.id) === String(params.order_id),
|
|
678
|
+
// );
|
|
665
679
|
if (!existingOrder) {
|
|
666
|
-
_context7.next =
|
|
680
|
+
_context7.next = 20;
|
|
667
681
|
break;
|
|
668
682
|
}
|
|
669
683
|
// 如果存在相同 order_id 的订单,更新该订单信息
|
|
670
|
-
|
|
671
|
-
|
|
684
|
+
this.logInfo("createPaymentOrderAsync found duplicate order ID: ".concat(params.order_id, ", updating existing payment order"));
|
|
685
|
+
|
|
686
|
+
// const originalOrder = { ...existingOrder };
|
|
672
687
|
existingOrder.order_info = params.order_info;
|
|
673
688
|
existingOrder.total_amount = params.total_amount;
|
|
674
689
|
existingOrder.is_deposit = params.is_deposit || 0;
|
|
@@ -678,14 +693,14 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
678
693
|
this.recalculateOrderAmount(existingOrder);
|
|
679
694
|
|
|
680
695
|
// 更新到数据库
|
|
681
|
-
_context7.next =
|
|
696
|
+
_context7.next = 15;
|
|
682
697
|
return this.dbManager.update('order', existingOrder);
|
|
683
|
-
case
|
|
684
|
-
_context7.next =
|
|
698
|
+
case 15:
|
|
699
|
+
_context7.next = 17;
|
|
685
700
|
return this.core.effects.emit(PaymentHooks.OnOrderUpdated, existingOrder);
|
|
686
|
-
case
|
|
701
|
+
case 17:
|
|
687
702
|
return _context7.abrupt("return", existingOrder);
|
|
688
|
-
case
|
|
703
|
+
case 20:
|
|
689
704
|
// 创建新的支付订单
|
|
690
705
|
newOrder = {
|
|
691
706
|
uuid: getUniqueId('pay_order_'),
|
|
@@ -701,33 +716,31 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
701
716
|
is_deposit: params.is_deposit || 0,
|
|
702
717
|
deposit_amount: params.deposit_amount || '0.00'
|
|
703
718
|
};
|
|
704
|
-
_context7.next =
|
|
719
|
+
_context7.next = 23;
|
|
705
720
|
return this.dbManager.add('order', newOrder);
|
|
706
|
-
case
|
|
707
|
-
|
|
708
|
-
return this.core.effects.emit(PaymentHooks.OnOrderAdded, newOrder);
|
|
709
|
-
case 26:
|
|
721
|
+
case 23:
|
|
722
|
+
this.core.effects.emit(PaymentHooks.OnOrderAdded, newOrder);
|
|
710
723
|
this.logInfo('createPaymentOrderAsync completed - new payment order created', {
|
|
711
724
|
orderUuid: newOrder.uuid,
|
|
712
725
|
orderId: newOrder.id
|
|
713
726
|
});
|
|
714
727
|
return _context7.abrupt("return", newOrder);
|
|
715
|
-
case
|
|
716
|
-
_context7.next =
|
|
728
|
+
case 26:
|
|
729
|
+
_context7.next = 33;
|
|
717
730
|
break;
|
|
718
|
-
case
|
|
719
|
-
_context7.prev =
|
|
731
|
+
case 28:
|
|
732
|
+
_context7.prev = 28;
|
|
720
733
|
_context7.t0 = _context7["catch"](1);
|
|
721
734
|
console.error('[PaymentModule] 创建支付订单失败', _context7.t0);
|
|
722
735
|
this.logError('createPaymentOrderAsync failed', _context7.t0, {
|
|
723
736
|
orderId: params.order_id
|
|
724
737
|
});
|
|
725
738
|
throw _context7.t0;
|
|
726
|
-
case
|
|
739
|
+
case 33:
|
|
727
740
|
case "end":
|
|
728
741
|
return _context7.stop();
|
|
729
742
|
}
|
|
730
|
-
}, _callee7, this, [[1,
|
|
743
|
+
}, _callee7, this, [[1, 28]]);
|
|
731
744
|
}));
|
|
732
745
|
function createPaymentOrderAsync(_x6) {
|
|
733
746
|
return _createPaymentOrderAsync.apply(this, arguments);
|
|
@@ -1030,7 +1043,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1030
1043
|
key: "addPaymentItemAsync",
|
|
1031
1044
|
value: (function () {
|
|
1032
1045
|
var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderUuid, paymentItem) {
|
|
1033
|
-
var _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, paymentUuid, newPaymentItem;
|
|
1046
|
+
var _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, warningMessage, paymentUuid, newPaymentItem;
|
|
1034
1047
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1035
1048
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1036
1049
|
case 0:
|
|
@@ -1051,6 +1064,27 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1051
1064
|
}
|
|
1052
1065
|
throw new Error("Order not found: ".concat(orderUuid));
|
|
1053
1066
|
case 7:
|
|
1067
|
+
// 🔒 支付锁检查:如果订单待付金额已经为0,不允许继续添加支付项
|
|
1068
|
+
expectAmount = new Decimal(order.expect_amount);
|
|
1069
|
+
if (!expectAmount.lte(0)) {
|
|
1070
|
+
_context13.next = 13;
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
warningMessage = "\u8BA2\u5355 ".concat(orderUuid, " \u5F85\u4ED8\u91D1\u989D\u5DF2\u4E3A0\uFF0C\u4E0D\u5141\u8BB8\u6DFB\u52A0\u65B0\u7684\u652F\u4ED8\u9879");
|
|
1074
|
+
console.warn('[PaymentModule] Payment lock triggered:', {
|
|
1075
|
+
orderUuid: orderUuid,
|
|
1076
|
+
expectAmount: order.expect_amount,
|
|
1077
|
+
attemptedPaymentAmount: paymentItem.amount,
|
|
1078
|
+
attemptedPaymentCode: paymentItem.code,
|
|
1079
|
+
reason: 'Order already fully paid'
|
|
1080
|
+
});
|
|
1081
|
+
this.logError('addPaymentItemAsync blocked by payment lock', new Error(warningMessage), {
|
|
1082
|
+
orderUuid: orderUuid,
|
|
1083
|
+
expectAmount: order.expect_amount,
|
|
1084
|
+
paymentItem: paymentItem
|
|
1085
|
+
});
|
|
1086
|
+
throw new Error(warningMessage);
|
|
1087
|
+
case 13:
|
|
1054
1088
|
paymentUuid = getUniqueId('payment_');
|
|
1055
1089
|
newPaymentItem = {
|
|
1056
1090
|
uuid: paymentUuid,
|
|
@@ -1073,15 +1107,15 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1073
1107
|
};
|
|
1074
1108
|
order.payment.push(newPaymentItem);
|
|
1075
1109
|
this.recalculateOrderAmount(order);
|
|
1076
|
-
_context13.next =
|
|
1110
|
+
_context13.next = 19;
|
|
1077
1111
|
return this.dbManager.update('order', order);
|
|
1078
|
-
case
|
|
1079
|
-
_context13.next =
|
|
1112
|
+
case 19:
|
|
1113
|
+
_context13.next = 21;
|
|
1080
1114
|
return this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
|
|
1081
1115
|
orderUuid: orderUuid,
|
|
1082
1116
|
payment: newPaymentItem
|
|
1083
1117
|
});
|
|
1084
|
-
case
|
|
1118
|
+
case 21:
|
|
1085
1119
|
this.logInfo('addPaymentItemAsync completed successfully', {
|
|
1086
1120
|
orderUuid: orderUuid,
|
|
1087
1121
|
paymentUuid: newPaymentItem.uuid,
|
|
@@ -1095,10 +1129,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1095
1129
|
actualPaidAmount: (_newPaymentItem$metad2 = newPaymentItem.metadata) === null || _newPaymentItem$metad2 === void 0 ? void 0 : _newPaymentItem$metad2.actual_paid_amount,
|
|
1096
1130
|
changeGivenAmount: (_newPaymentItem$metad3 = newPaymentItem.metadata) === null || _newPaymentItem$metad3 === void 0 ? void 0 : _newPaymentItem$metad3.change_given_amount
|
|
1097
1131
|
});
|
|
1098
|
-
_context13.next =
|
|
1132
|
+
_context13.next = 29;
|
|
1099
1133
|
break;
|
|
1100
|
-
case
|
|
1101
|
-
_context13.prev =
|
|
1134
|
+
case 24:
|
|
1135
|
+
_context13.prev = 24;
|
|
1102
1136
|
_context13.t0 = _context13["catch"](1);
|
|
1103
1137
|
console.error('[PaymentModule] 添加支付项失败', _context13.t0);
|
|
1104
1138
|
this.logError('addPaymentItemAsync failed', _context13.t0, {
|
|
@@ -1106,11 +1140,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1106
1140
|
paymentItem: paymentItem
|
|
1107
1141
|
});
|
|
1108
1142
|
throw _context13.t0;
|
|
1109
|
-
case
|
|
1143
|
+
case 29:
|
|
1110
1144
|
case "end":
|
|
1111
1145
|
return _context13.stop();
|
|
1112
1146
|
}
|
|
1113
|
-
}, _callee13, this, [[1,
|
|
1147
|
+
}, _callee13, this, [[1, 24]]);
|
|
1114
1148
|
}));
|
|
1115
1149
|
function addPaymentItemAsync(_x14, _x15) {
|
|
1116
1150
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -406,9 +406,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
406
406
|
});
|
|
407
407
|
|
|
408
408
|
// 检查识别码是否为9位且前3位为"000"
|
|
409
|
-
|
|
410
|
-
//
|
|
411
|
-
isWalletCode = code.startsWith('WL');
|
|
409
|
+
isWalletCode = code.length === 9 && code.startsWith('000'); // 测试环境先使用 WL
|
|
410
|
+
// const isWalletCode = code.startsWith('WL');
|
|
412
411
|
if (!isWalletCode) {
|
|
413
412
|
_context5.next = 14;
|
|
414
413
|
break;
|
|
@@ -443,7 +442,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
443
442
|
baseWalletParams = this.walletParams; // 构建完整的搜索参数,包含钱包扣款推荐的所有参数
|
|
444
443
|
searchParams = {
|
|
445
444
|
// 基础钱包参数
|
|
446
|
-
sale_channel: params.sale_channel || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.sale_channel),
|
|
445
|
+
sale_channel: params.sale_channel || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.sale_channel) || "pos",
|
|
447
446
|
customer_id: params.customer_id || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.customer_id),
|
|
448
447
|
order_expect_amount: params.order_expect_amount || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_expect_amount),
|
|
449
448
|
order_product_amount: params.order_product_amount || (baseWalletParams === null || baseWalletParams === void 0 ? void 0 : baseWalletParams.order_product_amount),
|
|
@@ -329,6 +329,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
329
329
|
tag: discountType,
|
|
330
330
|
discount: {
|
|
331
331
|
discount_card_type: discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.discount_card_type,
|
|
332
|
+
fixed_amount: product.price,
|
|
332
333
|
resource_id: discount.id,
|
|
333
334
|
title: discount.format_title,
|
|
334
335
|
original_amount: product.origin_total,
|
|
@@ -498,6 +499,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
498
499
|
type: discountType,
|
|
499
500
|
discount: {
|
|
500
501
|
discount_card_type: _selectedDiscount === null || _selectedDiscount === void 0 || (_selectedDiscount$met = _selectedDiscount.metadata) === null || _selectedDiscount$met === void 0 ? void 0 : _selectedDiscount$met.discount_card_type,
|
|
502
|
+
fixed_amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
|
|
501
503
|
resource_id: _selectedDiscount.id,
|
|
502
504
|
title: _selectedDiscount.format_title,
|
|
503
505
|
original_amount: productOriginTotal,
|
|
@@ -254,6 +254,15 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
254
254
|
var _schedule$repeat_rule, _schedule$repeat_rule2;
|
|
255
255
|
var date = _ref2.date,
|
|
256
256
|
schedule = _ref2.schedule;
|
|
257
|
+
if (schedule.start_time && schedule.end_time) {
|
|
258
|
+
var isBeforeStartTime = dayjs(date).isBefore(dayjs(schedule.start_time));
|
|
259
|
+
var isAfterEndTime = dayjs(date).isAfter(dayjs(schedule.end_time));
|
|
260
|
+
// 如果不在 schedule 日期区间内直接返回false
|
|
261
|
+
if (isBeforeStartTime || isAfterEndTime) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
257
266
|
// 节约性能, 强制将schedule的时间范围改为前后一天,避免大量计算.
|
|
258
267
|
var _schedule = _objectSpread(_objectSpread({}, schedule), {}, {
|
|
259
268
|
// 开始时间向前推一天
|
|
@@ -180,7 +180,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
180
180
|
* @param {ProductData} productData
|
|
181
181
|
* @memberof BookingByStepImpl
|
|
182
182
|
*/
|
|
183
|
-
storeProduct(productData: ProductData):
|
|
183
|
+
storeProduct(productData: ProductData): {
|
|
184
|
+
success: boolean;
|
|
185
|
+
errorCode?: string;
|
|
186
|
+
};
|
|
184
187
|
/**
|
|
185
188
|
* 往购物车加商品数据
|
|
186
189
|
*
|
|
@@ -203,7 +206,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
203
206
|
endTime: string;
|
|
204
207
|
} | null;
|
|
205
208
|
account?: Account | null;
|
|
206
|
-
}):
|
|
209
|
+
}): {
|
|
210
|
+
success: boolean;
|
|
211
|
+
errorCode?: string;
|
|
212
|
+
};
|
|
207
213
|
/**
|
|
208
214
|
* 添加完购物车以后做的一些检测,比如日期是否在同一天
|
|
209
215
|
*
|
|
@@ -294,8 +300,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
294
300
|
};
|
|
295
301
|
getTimeSlotByAllResources(resources_code: string): any[];
|
|
296
302
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
297
|
-
clearCache(): void;
|
|
298
|
-
clearCacheByModule(module: string): void;
|
|
299
303
|
private getScheduleDataByIds;
|
|
300
304
|
openProductDetail(productId: number): Promise<void>;
|
|
301
305
|
closeProductDetail(): void;
|
|
@@ -312,6 +316,14 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
312
316
|
count: number;
|
|
313
317
|
left: number;
|
|
314
318
|
}[];
|
|
319
|
+
/**
|
|
320
|
+
* 找到多个资源的公共可用时间段
|
|
321
|
+
*/
|
|
322
|
+
private findCommonAvailableTimeSlots;
|
|
323
|
+
checkMaxDurationCapacity(): {
|
|
324
|
+
success: boolean;
|
|
325
|
+
minAvailableCount: number;
|
|
326
|
+
};
|
|
315
327
|
setOtherData(key: string, value: any): void;
|
|
316
328
|
getOtherData(key: string): any;
|
|
317
329
|
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|