@pisell/pisellos 2.1.17 → 2.1.19
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/Payment/index.js +42 -79
- package/dist/modules/Product/index.d.ts +1 -1
- 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/Checkout/index.js +47 -43
- package/lib/modules/Date/index.js +3 -0
- package/lib/modules/Payment/index.js +0 -30
- package/lib/modules/Product/index.d.ts +1 -1
- 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/Checkout/index.js +8 -4
- 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
|
// 过滤和修正时间段
|
|
@@ -1264,7 +1264,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1264
1264
|
key: "updateVoucherPaymentItemsAsync",
|
|
1265
1265
|
value: (function () {
|
|
1266
1266
|
var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(orderUuid, voucherPaymentItems) {
|
|
1267
|
-
var order,
|
|
1267
|
+
var order, existingVoucherItems, _iterator5, _step5, voucherItem, _iterator6, _step6, _voucherItem, updatedOrder;
|
|
1268
1268
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1269
1269
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1270
1270
|
case 0:
|
|
@@ -1291,43 +1291,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1291
1291
|
}
|
|
1292
1292
|
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728: ".concat(orderUuid));
|
|
1293
1293
|
case 7:
|
|
1294
|
-
// 🔒 订单状态检查:如果订单待付金额已经为0且尝试清空代金券(空数组),跳过操作
|
|
1295
|
-
expectAmount = new Decimal(order.expect_amount);
|
|
1296
|
-
if (!(expectAmount.lte(0) && voucherPaymentItems.length === 0)) {
|
|
1297
|
-
_context15.next = 12;
|
|
1298
|
-
break;
|
|
1299
|
-
}
|
|
1300
|
-
console.warn('[PaymentModule] Skipping voucher update - order already fully paid:', {
|
|
1301
|
-
orderUuid: orderUuid,
|
|
1302
|
-
expectAmount: order.expect_amount,
|
|
1303
|
-
attemptedOperation: 'clear_vouchers',
|
|
1304
|
-
reason: 'Order payment completed, no need to clear vouchers'
|
|
1305
|
-
});
|
|
1306
|
-
this.logInfo('updateVoucherPaymentItemsAsync skipped - order already paid', {
|
|
1307
|
-
orderUuid: orderUuid,
|
|
1308
|
-
expectAmount: order.expect_amount,
|
|
1309
|
-
voucherCount: voucherPaymentItems.length
|
|
1310
|
-
});
|
|
1311
|
-
return _context15.abrupt("return");
|
|
1312
|
-
case 12:
|
|
1313
|
-
if (!(expectAmount.lte(0) && voucherPaymentItems.length > 0)) {
|
|
1314
|
-
_context15.next = 17;
|
|
1315
|
-
break;
|
|
1316
|
-
}
|
|
1317
|
-
warningMessage = "\u8BA2\u5355 ".concat(orderUuid, " \u5DF2\u5B8C\u6210\u652F\u4ED8\uFF0C\u4E0D\u5141\u8BB8\u6DFB\u52A0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879");
|
|
1318
|
-
console.warn('[PaymentModule] Voucher update blocked - order already fully paid:', {
|
|
1319
|
-
orderUuid: orderUuid,
|
|
1320
|
-
expectAmount: order.expect_amount,
|
|
1321
|
-
attemptedVoucherCount: voucherPaymentItems.length,
|
|
1322
|
-
reason: 'Order already fully paid'
|
|
1323
|
-
});
|
|
1324
|
-
this.logError('updateVoucherPaymentItemsAsync blocked', new Error(warningMessage), {
|
|
1325
|
-
orderUuid: orderUuid,
|
|
1326
|
-
expectAmount: order.expect_amount,
|
|
1327
|
-
voucherPaymentItems: voucherPaymentItems
|
|
1328
|
-
});
|
|
1329
|
-
throw new Error(warningMessage);
|
|
1330
|
-
case 17:
|
|
1331
1294
|
// 1. 查找所有现有的代金券类支付项(带 voucher_id 且状态不是 voided)
|
|
1332
1295
|
existingVoucherItems = order.payment.filter(function (payment) {
|
|
1333
1296
|
return payment.voucher_id && payment.status !== 'voided';
|
|
@@ -1347,96 +1310,96 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1347
1310
|
|
|
1348
1311
|
// 2. 删除所有现有的代金券支付项
|
|
1349
1312
|
_iterator5 = _createForOfIteratorHelper(existingVoucherItems);
|
|
1350
|
-
_context15.prev =
|
|
1313
|
+
_context15.prev = 10;
|
|
1351
1314
|
_iterator5.s();
|
|
1352
|
-
case
|
|
1315
|
+
case 12:
|
|
1353
1316
|
if ((_step5 = _iterator5.n()).done) {
|
|
1354
|
-
_context15.next =
|
|
1317
|
+
_context15.next = 19;
|
|
1355
1318
|
break;
|
|
1356
1319
|
}
|
|
1357
1320
|
voucherItem = _step5.value;
|
|
1358
1321
|
console.log("[PaymentModule] \u5220\u9664\u73B0\u6709\u4EE3\u91D1\u5238\u652F\u4ED8\u9879: ".concat(voucherItem.uuid));
|
|
1359
|
-
_context15.next =
|
|
1322
|
+
_context15.next = 17;
|
|
1360
1323
|
return this.deletePaymentAsync(orderUuid, voucherItem.uuid);
|
|
1361
|
-
case
|
|
1362
|
-
_context15.next =
|
|
1324
|
+
case 17:
|
|
1325
|
+
_context15.next = 12;
|
|
1363
1326
|
break;
|
|
1364
|
-
case
|
|
1365
|
-
_context15.next =
|
|
1327
|
+
case 19:
|
|
1328
|
+
_context15.next = 24;
|
|
1366
1329
|
break;
|
|
1367
|
-
case
|
|
1368
|
-
_context15.prev =
|
|
1369
|
-
_context15.t0 = _context15["catch"](
|
|
1330
|
+
case 21:
|
|
1331
|
+
_context15.prev = 21;
|
|
1332
|
+
_context15.t0 = _context15["catch"](10);
|
|
1370
1333
|
_iterator5.e(_context15.t0);
|
|
1371
|
-
case
|
|
1372
|
-
_context15.prev =
|
|
1334
|
+
case 24:
|
|
1335
|
+
_context15.prev = 24;
|
|
1373
1336
|
_iterator5.f();
|
|
1374
|
-
return _context15.finish(
|
|
1375
|
-
case
|
|
1337
|
+
return _context15.finish(24);
|
|
1338
|
+
case 27:
|
|
1376
1339
|
// 3. 添加新的代金券支付项
|
|
1377
1340
|
console.log('[PaymentModule] 添加新的代金券支付项:', {
|
|
1378
1341
|
orderUuid: orderUuid,
|
|
1379
1342
|
newItemCount: voucherPaymentItems.length
|
|
1380
1343
|
});
|
|
1381
1344
|
_iterator6 = _createForOfIteratorHelper(voucherPaymentItems);
|
|
1382
|
-
_context15.prev =
|
|
1345
|
+
_context15.prev = 29;
|
|
1383
1346
|
_iterator6.s();
|
|
1384
|
-
case
|
|
1347
|
+
case 31:
|
|
1385
1348
|
if ((_step6 = _iterator6.n()).done) {
|
|
1386
|
-
_context15.next =
|
|
1349
|
+
_context15.next = 40;
|
|
1387
1350
|
break;
|
|
1388
1351
|
}
|
|
1389
1352
|
_voucherItem = _step6.value;
|
|
1390
1353
|
if (_voucherItem.voucher_id) {
|
|
1391
|
-
_context15.next =
|
|
1354
|
+
_context15.next = 35;
|
|
1392
1355
|
break;
|
|
1393
1356
|
}
|
|
1394
1357
|
throw new Error("\u4EE3\u91D1\u5238\u652F\u4ED8\u9879\u7F3A\u5C11 voucher_id: ".concat(JSON.stringify(_voucherItem)));
|
|
1395
|
-
case
|
|
1358
|
+
case 35:
|
|
1396
1359
|
console.log("[PaymentModule] \u6DFB\u52A0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:", {
|
|
1397
1360
|
code: _voucherItem.code,
|
|
1398
1361
|
amount: _voucherItem.amount,
|
|
1399
1362
|
voucher_id: _voucherItem.voucher_id,
|
|
1400
1363
|
order_payment_type: _voucherItem.order_payment_type
|
|
1401
1364
|
});
|
|
1402
|
-
_context15.next =
|
|
1365
|
+
_context15.next = 38;
|
|
1403
1366
|
return this.addPaymentItemAsync(orderUuid, _voucherItem);
|
|
1404
|
-
case
|
|
1405
|
-
_context15.next =
|
|
1367
|
+
case 38:
|
|
1368
|
+
_context15.next = 31;
|
|
1406
1369
|
break;
|
|
1407
|
-
case
|
|
1408
|
-
_context15.next =
|
|
1370
|
+
case 40:
|
|
1371
|
+
_context15.next = 45;
|
|
1409
1372
|
break;
|
|
1410
|
-
case
|
|
1411
|
-
_context15.prev =
|
|
1412
|
-
_context15.t1 = _context15["catch"](
|
|
1373
|
+
case 42:
|
|
1374
|
+
_context15.prev = 42;
|
|
1375
|
+
_context15.t1 = _context15["catch"](29);
|
|
1413
1376
|
_iterator6.e(_context15.t1);
|
|
1414
|
-
case
|
|
1415
|
-
_context15.prev =
|
|
1377
|
+
case 45:
|
|
1378
|
+
_context15.prev = 45;
|
|
1416
1379
|
_iterator6.f();
|
|
1417
|
-
return _context15.finish(
|
|
1418
|
-
case
|
|
1419
|
-
_context15.next =
|
|
1380
|
+
return _context15.finish(45);
|
|
1381
|
+
case 48:
|
|
1382
|
+
_context15.next = 50;
|
|
1420
1383
|
return this.getPaymentOrderByUuidAsync(orderUuid);
|
|
1421
|
-
case
|
|
1384
|
+
case 50:
|
|
1422
1385
|
updatedOrder = _context15.sent;
|
|
1423
|
-
_context15.next =
|
|
1386
|
+
_context15.next = 53;
|
|
1424
1387
|
return this.core.effects.emit(PaymentHooks.OnPaymentAdded, {
|
|
1425
1388
|
orderUuid: orderUuid,
|
|
1426
1389
|
order: updatedOrder,
|
|
1427
1390
|
payment: null // 批量操作不提供单个支付项
|
|
1428
1391
|
});
|
|
1429
|
-
case
|
|
1392
|
+
case 53:
|
|
1430
1393
|
this.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
|
|
1431
1394
|
orderUuid: orderUuid,
|
|
1432
1395
|
removedVoucherCount: existingVoucherItems.length,
|
|
1433
1396
|
addedVoucherCount: voucherPaymentItems.length,
|
|
1434
1397
|
finalExpectAmount: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.expect_amount
|
|
1435
1398
|
});
|
|
1436
|
-
_context15.next =
|
|
1399
|
+
_context15.next = 61;
|
|
1437
1400
|
break;
|
|
1438
|
-
case
|
|
1439
|
-
_context15.prev =
|
|
1401
|
+
case 56:
|
|
1402
|
+
_context15.prev = 56;
|
|
1440
1403
|
_context15.t2 = _context15["catch"](1);
|
|
1441
1404
|
console.error('[PaymentModule] 批量更新代金券支付项失败:', _context15.t2);
|
|
1442
1405
|
this.logError('updateVoucherPaymentItemsAsync failed', _context15.t2, {
|
|
@@ -1444,11 +1407,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1444
1407
|
voucherPaymentItems: voucherPaymentItems
|
|
1445
1408
|
});
|
|
1446
1409
|
throw _context15.t2;
|
|
1447
|
-
case
|
|
1410
|
+
case 61:
|
|
1448
1411
|
case "end":
|
|
1449
1412
|
return _context15.stop();
|
|
1450
1413
|
}
|
|
1451
|
-
}, _callee15, this, [[1,
|
|
1414
|
+
}, _callee15, this, [[1, 56], [10, 21, 24, 27], [29, 42, 45, 48]]);
|
|
1452
1415
|
}));
|
|
1453
1416
|
function updateVoucherPaymentItemsAsync(_x18, _x19) {
|
|
1454
1417
|
return _updateVoucherPaymentItemsAsync.apply(this, arguments);
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -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">;
|