@pisell/pisellos 2.2.273 → 2.2.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +0 -8
- package/dist/modules/Order/index.d.ts +13 -32
- package/dist/modules/Order/index.js +555 -771
- package/dist/modules/Order/types.d.ts +22 -36
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.js +6 -10
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +27 -29
- package/dist/modules/Payment/types.js +3 -5
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +39 -55
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +0 -16
- package/dist/server/index.js +1036 -1933
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +25 -59
- package/dist/solution/BaseSales/index.js +490 -767
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +36 -93
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +5 -21
- package/dist/solution/BookingTicket/index.js +49 -126
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.js +20 -31
- package/dist/solution/VenueBooking/index.js +19 -30
- package/dist/types/index.d.ts +0 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +0 -5
- package/lib/modules/Order/index.d.ts +13 -32
- package/lib/modules/Order/index.js +142 -201
- package/lib/modules/Order/types.d.ts +22 -36
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.js +4 -11
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +27 -29
- package/lib/modules/Payment/types.js +3 -3
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +22 -41
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +0 -16
- package/lib/server/index.js +18 -670
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +25 -59
- package/lib/solution/BaseSales/index.js +79 -246
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +17 -65
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -21
- package/lib/solution/BookingTicket/index.js +8 -59
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.js +0 -8
- package/lib/solution/VenueBooking/index.js +0 -8
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -337,10 +337,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
337
337
|
key: "getOpenData",
|
|
338
338
|
value: function () {
|
|
339
339
|
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
340
|
+
var _this$store$openData;
|
|
340
341
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
341
342
|
while (1) switch (_context3.prev = _context3.next) {
|
|
342
343
|
case 0:
|
|
343
|
-
return _context3.abrupt("return", this.
|
|
344
|
+
return _context3.abrupt("return", (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData());
|
|
344
345
|
case 1:
|
|
345
346
|
case "end":
|
|
346
347
|
return _context3.stop();
|
|
@@ -351,15 +352,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
351
352
|
return _getOpenData.apply(this, arguments);
|
|
352
353
|
}
|
|
353
354
|
return getOpenData;
|
|
354
|
-
}()
|
|
355
|
-
}, {
|
|
356
|
-
key: "clearOpenDataCache",
|
|
357
|
-
value: function clearOpenDataCache() {
|
|
358
|
-
var _this$store$openData;
|
|
359
|
-
this.loadOpenDataConfigInFlight = null;
|
|
360
|
-
this.otherParams.openData = null;
|
|
361
|
-
(_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || _this$store$openData.clearCache();
|
|
362
|
-
}
|
|
355
|
+
}()
|
|
363
356
|
}, {
|
|
364
357
|
key: "getShortNumberOrDeviceId",
|
|
365
358
|
value: function () {
|
|
@@ -404,52 +397,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
404
397
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
405
398
|
while (1) switch (_context5.prev = _context5.next) {
|
|
406
399
|
case 0:
|
|
407
|
-
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
408
|
-
this.setPaymentNumberDevicePrefix(null);
|
|
409
400
|
openDataConfig = null;
|
|
410
|
-
_context5.prev =
|
|
411
|
-
_context5.next =
|
|
401
|
+
_context5.prev = 1;
|
|
402
|
+
_context5.next = 4;
|
|
412
403
|
return this.loadOpenDataConfig();
|
|
413
|
-
case
|
|
404
|
+
case 4:
|
|
414
405
|
openDataConfig = _context5.sent;
|
|
415
|
-
_context5.next =
|
|
406
|
+
_context5.next = 11;
|
|
416
407
|
break;
|
|
417
|
-
case
|
|
418
|
-
_context5.prev =
|
|
419
|
-
_context5.t0 = _context5["catch"](
|
|
408
|
+
case 7:
|
|
409
|
+
_context5.prev = 7;
|
|
410
|
+
_context5.t0 = _context5["catch"](1);
|
|
420
411
|
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
|
|
421
412
|
return _context5.abrupt("return");
|
|
422
|
-
case
|
|
413
|
+
case 11:
|
|
423
414
|
// if (!openDataConfig) return;
|
|
424
415
|
idGenerator = this.getIdGeneratorPlugin();
|
|
425
416
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
426
|
-
_context5.next =
|
|
417
|
+
_context5.next = 15;
|
|
427
418
|
break;
|
|
428
419
|
}
|
|
429
420
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
430
421
|
return _context5.abrupt("return");
|
|
431
|
-
case
|
|
422
|
+
case 15:
|
|
432
423
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
433
424
|
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
434
425
|
prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
|
|
435
426
|
shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
|
|
436
427
|
resetReceiptSequenceDaily = typeof ((_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig6 = openDataConfig) === null || _openDataConfig6 === void 0 ? void 0 : _openDataConfig6['sale.short_number_daily_reset'] : false;
|
|
437
428
|
operatingDayBoundary = this.getAppData('operating_day_boundary');
|
|
438
|
-
_context5.next =
|
|
429
|
+
_context5.next = 23;
|
|
439
430
|
return this.getShortNumberOrDeviceId();
|
|
440
|
-
case
|
|
431
|
+
case 23:
|
|
441
432
|
deviceId = _context5.sent;
|
|
442
|
-
this.setPaymentNumberDevicePrefix(deviceId);
|
|
443
433
|
businessCode = this.getBookingTicketBusinessCode();
|
|
444
434
|
if (businessCode) {
|
|
445
|
-
_context5.next =
|
|
435
|
+
_context5.next = 28;
|
|
446
436
|
break;
|
|
447
437
|
}
|
|
448
438
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
449
439
|
return _context5.abrupt("return");
|
|
450
|
-
case
|
|
451
|
-
_context5.prev =
|
|
452
|
-
_context5.next =
|
|
440
|
+
case 28:
|
|
441
|
+
_context5.prev = 28;
|
|
442
|
+
_context5.next = 31;
|
|
453
443
|
return idGenerator.configure({
|
|
454
444
|
biz: businessCode,
|
|
455
445
|
config: {
|
|
@@ -464,18 +454,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
464
454
|
shopOrderPrefix: shopOrderPrefix
|
|
465
455
|
}
|
|
466
456
|
});
|
|
467
|
-
case
|
|
468
|
-
_context5.next =
|
|
457
|
+
case 31:
|
|
458
|
+
_context5.next = 36;
|
|
469
459
|
break;
|
|
470
|
-
case
|
|
471
|
-
_context5.prev =
|
|
472
|
-
_context5.t1 = _context5["catch"](
|
|
460
|
+
case 33:
|
|
461
|
+
_context5.prev = 33;
|
|
462
|
+
_context5.t1 = _context5["catch"](28);
|
|
473
463
|
console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
|
|
474
|
-
case
|
|
464
|
+
case 36:
|
|
475
465
|
case "end":
|
|
476
466
|
return _context5.stop();
|
|
477
467
|
}
|
|
478
|
-
}, _callee5, this, [[
|
|
468
|
+
}, _callee5, this, [[1, 7], [28, 33]]);
|
|
479
469
|
}));
|
|
480
470
|
function configureIdGeneratorFromOpenData() {
|
|
481
471
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -1270,88 +1260,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1270
1260
|
}
|
|
1271
1261
|
|
|
1272
1262
|
/**
|
|
1273
|
-
* 通过 ids
|
|
1274
|
-
*
|
|
1263
|
+
* 通过 ids 获取商品列表(不加载到模块中)
|
|
1264
|
+
* @returns 商品列表
|
|
1275
1265
|
*/
|
|
1276
1266
|
}, {
|
|
1277
1267
|
key: "getProductByIds",
|
|
1278
1268
|
value: (function () {
|
|
1279
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids
|
|
1280
|
-
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1281
|
-
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1269
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
|
|
1282
1270
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1283
1271
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1284
1272
|
case 0:
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
}).filter(function (id) {
|
|
1288
|
-
return Number.isFinite(id);
|
|
1289
|
-
})));
|
|
1290
|
-
_context18.next = 3;
|
|
1291
|
-
return this.store.products.getProductByIds(normalizedIds);
|
|
1292
|
-
case 3:
|
|
1293
|
-
_context18.t0 = _context18.sent;
|
|
1294
|
-
if (_context18.t0) {
|
|
1295
|
-
_context18.next = 6;
|
|
1296
|
-
break;
|
|
1297
|
-
}
|
|
1298
|
-
_context18.t0 = [];
|
|
1299
|
-
case 6:
|
|
1300
|
-
localProducts = _context18.t0;
|
|
1301
|
-
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1302
|
-
_context18.next = 9;
|
|
1303
|
-
break;
|
|
1304
|
-
}
|
|
1305
|
-
return _context18.abrupt("return", localProducts);
|
|
1306
|
-
case 9:
|
|
1307
|
-
localProductIds = new Set(localProducts.map(function (product) {
|
|
1308
|
-
return Number(product.id);
|
|
1309
|
-
}));
|
|
1310
|
-
missingIds = normalizedIds.filter(function (id) {
|
|
1311
|
-
return !localProductIds.has(id);
|
|
1312
|
-
});
|
|
1313
|
-
if (missingIds.length) {
|
|
1314
|
-
_context18.next = 13;
|
|
1315
|
-
break;
|
|
1316
|
-
}
|
|
1317
|
-
return _context18.abrupt("return", localProducts);
|
|
1318
|
-
case 13:
|
|
1319
|
-
rawBookingDate = this.getBookingDate();
|
|
1320
|
-
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1321
|
-
customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
|
|
1322
|
-
_context18.next = 18;
|
|
1323
|
-
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1324
|
-
product_ids: missingIds,
|
|
1325
|
-
with_count: ['bundleGroup', 'optionGroup'],
|
|
1326
|
-
with_schedule: 1,
|
|
1327
|
-
cacheId: this.cacheId
|
|
1328
|
-
}, bookingDate ? {
|
|
1329
|
-
schedule_date: bookingDate.format('YYYY-MM-DD'),
|
|
1330
|
-
schedule_datetime: bookingDate.format('YYYY-MM-DD HH:mm:ss')
|
|
1331
|
-
} : {}), Number.isFinite(customerId) && customerId > 0 ? {
|
|
1332
|
-
customer_id: customerId
|
|
1333
|
-
} : {}));
|
|
1334
|
-
case 18:
|
|
1335
|
-
loadedProducts = _context18.sent;
|
|
1336
|
-
productById = new Map();
|
|
1337
|
-
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1338
|
-
var productId = Number(product.id);
|
|
1339
|
-
if (Number.isFinite(productId)) {
|
|
1340
|
-
productById.set(productId, product);
|
|
1341
|
-
}
|
|
1342
|
-
});
|
|
1343
|
-
return _context18.abrupt("return", normalizedIds.map(function (id) {
|
|
1344
|
-
return productById.get(id);
|
|
1345
|
-
}).filter(function (product) {
|
|
1346
|
-
return Boolean(product);
|
|
1347
|
-
}));
|
|
1348
|
-
case 22:
|
|
1273
|
+
return _context18.abrupt("return", this.store.products.getProductByIds(ids));
|
|
1274
|
+
case 1:
|
|
1349
1275
|
case "end":
|
|
1350
1276
|
return _context18.stop();
|
|
1351
1277
|
}
|
|
1352
1278
|
}, _callee18, this);
|
|
1353
1279
|
}));
|
|
1354
|
-
function getProductByIds(_x13
|
|
1280
|
+
function getProductByIds(_x13) {
|
|
1355
1281
|
return _getProductByIds.apply(this, arguments);
|
|
1356
1282
|
}
|
|
1357
1283
|
return getProductByIds;
|
|
@@ -1385,7 +1311,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1385
1311
|
}
|
|
1386
1312
|
}, _callee19, this);
|
|
1387
1313
|
}));
|
|
1388
|
-
function getScheduleTimePoints(
|
|
1314
|
+
function getScheduleTimePoints(_x14) {
|
|
1389
1315
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
1390
1316
|
}
|
|
1391
1317
|
return getScheduleTimePoints;
|
|
@@ -1775,7 +1701,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1775
1701
|
}
|
|
1776
1702
|
}, _callee23, this, [[0, 7]]);
|
|
1777
1703
|
}));
|
|
1778
|
-
function changeCustomerPage(
|
|
1704
|
+
function changeCustomerPage(_x15, _x16) {
|
|
1779
1705
|
return _changeCustomerPage.apply(this, arguments);
|
|
1780
1706
|
}
|
|
1781
1707
|
return changeCustomerPage;
|
|
@@ -2067,8 +1993,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2067
1993
|
}, {
|
|
2068
1994
|
key: "getBookingConfig",
|
|
2069
1995
|
value: function getBookingConfig() {
|
|
2070
|
-
|
|
2071
|
-
return (_this$store$bookingCo = this.store.bookingContext) === null || _this$store$bookingCo === void 0 ? void 0 : _this$store$bookingCo.getBookingConfig();
|
|
1996
|
+
return this.store.bookingContext.getBookingConfig();
|
|
2072
1997
|
}
|
|
2073
1998
|
|
|
2074
1999
|
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
@@ -2229,10 +2154,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2229
2154
|
}, {
|
|
2230
2155
|
key: "buildAddProductCtx",
|
|
2231
2156
|
value: function buildAddProductCtx(extra) {
|
|
2232
|
-
var _extra$date2, _ref12, _this$
|
|
2157
|
+
var _extra$date2, _ref12, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
|
|
2233
2158
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2234
2159
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2235
|
-
var orderCustomerId = (_ref12 = (_this$
|
|
2160
|
+
var orderCustomerId = (_ref12 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
|
|
2236
2161
|
return _objectSpread({
|
|
2237
2162
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2238
2163
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2349,7 +2274,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2349
2274
|
}
|
|
2350
2275
|
}, _callee27, this);
|
|
2351
2276
|
}));
|
|
2352
|
-
function updateProductInOrder(
|
|
2277
|
+
function updateProductInOrder(_x17) {
|
|
2353
2278
|
return _updateProductInOrder.apply(this, arguments);
|
|
2354
2279
|
}
|
|
2355
2280
|
return updateProductInOrder;
|
|
@@ -2458,7 +2383,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2458
2383
|
}
|
|
2459
2384
|
}, _callee28, this, [[4, 21]]);
|
|
2460
2385
|
}));
|
|
2461
|
-
function handleGlobalScanCode(
|
|
2386
|
+
function handleGlobalScanCode(_x18, _x19) {
|
|
2462
2387
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2463
2388
|
}
|
|
2464
2389
|
return handleGlobalScanCode;
|
|
@@ -2556,7 +2481,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2556
2481
|
}
|
|
2557
2482
|
}, _callee29, this);
|
|
2558
2483
|
}));
|
|
2559
|
-
function addAddTimeProductToBooking(
|
|
2484
|
+
function addAddTimeProductToBooking(_x20) {
|
|
2560
2485
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
2561
2486
|
}
|
|
2562
2487
|
return addAddTimeProductToBooking;
|
|
@@ -2659,7 +2584,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2659
2584
|
}
|
|
2660
2585
|
}, _callee30, this, [[13, 31, 34, 37]]);
|
|
2661
2586
|
}));
|
|
2662
|
-
function addAddTimeProductsToBooking(
|
|
2587
|
+
function addAddTimeProductsToBooking(_x21) {
|
|
2663
2588
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
2664
2589
|
}
|
|
2665
2590
|
return addAddTimeProductsToBooking;
|
|
@@ -2676,24 +2601,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2676
2601
|
while (1) switch (_context31.prev = _context31.next) {
|
|
2677
2602
|
case 0:
|
|
2678
2603
|
_ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
2679
|
-
|
|
2680
|
-
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
2604
|
+
_get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
2681
2605
|
cover: cover
|
|
2682
2606
|
});
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
_context31.next = 6;
|
|
2607
|
+
if (!(params !== null && params !== void 0 && params.businessCode)) {
|
|
2608
|
+
_context31.next = 5;
|
|
2686
2609
|
break;
|
|
2687
2610
|
}
|
|
2688
|
-
_context31.next =
|
|
2611
|
+
_context31.next = 5;
|
|
2689
2612
|
return this.configureIdGeneratorFromOpenData();
|
|
2690
|
-
case
|
|
2613
|
+
case 5:
|
|
2691
2614
|
case "end":
|
|
2692
2615
|
return _context31.stop();
|
|
2693
2616
|
}
|
|
2694
2617
|
}, _callee31, this);
|
|
2695
2618
|
}));
|
|
2696
|
-
function setOtherParams(
|
|
2619
|
+
function setOtherParams(_x22) {
|
|
2697
2620
|
return _setOtherParams.apply(this, arguments);
|
|
2698
2621
|
}
|
|
2699
2622
|
return setOtherParams;
|
|
@@ -2764,7 +2687,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2764
2687
|
}
|
|
2765
2688
|
}, _callee32, this);
|
|
2766
2689
|
}));
|
|
2767
|
-
function handlePrintWristband(
|
|
2690
|
+
function handlePrintWristband(_x23) {
|
|
2768
2691
|
return _handlePrintWristband.apply(this, arguments);
|
|
2769
2692
|
}
|
|
2770
2693
|
return handlePrintWristband;
|
|
@@ -2839,7 +2762,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2839
2762
|
}
|
|
2840
2763
|
}, _callee33, this);
|
|
2841
2764
|
}));
|
|
2842
|
-
function handleRedeem(
|
|
2765
|
+
function handleRedeem(_x24) {
|
|
2843
2766
|
return _handleRedeem.apply(this, arguments);
|
|
2844
2767
|
}
|
|
2845
2768
|
return handleRedeem;
|
|
@@ -118,12 +118,15 @@ export interface BookingTicketCartBookingView extends ISalesBooking {
|
|
|
118
118
|
canAddTime: boolean;
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
+
export type BookingTicketCartLineView = BookingTicketCartBookingView | BookingTicketCartItemView;
|
|
121
122
|
/**
|
|
122
123
|
* BookingTicket 面向 UI 的购物车视图。
|
|
123
124
|
*/
|
|
124
125
|
export interface BookingTicketCartView {
|
|
125
126
|
bookings: BookingTicketCartBookingView[];
|
|
126
127
|
items: BookingTicketCartItemView[];
|
|
128
|
+
/** 以 tempOrder.products 为唯一顺序真源的统一购物车行(旧到新)。 */
|
|
129
|
+
lines: BookingTicketCartLineView[];
|
|
127
130
|
}
|
|
128
131
|
/**
|
|
129
132
|
* BookingTicket 面向 UI 的客户展示视图。
|
|
@@ -108,33 +108,28 @@ export function buildCartView(lines, bookings) {
|
|
|
108
108
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
109
109
|
var productLines = Array.isArray(lines) ? lines : [];
|
|
110
110
|
var bookingList = Array.isArray(bookings) ? bookings : [];
|
|
111
|
+
var childBookings = bookingList.filter(function (booking) {
|
|
112
|
+
return booking.parent_id !== 0;
|
|
113
|
+
});
|
|
114
|
+
var bookingsByProductUid = indexBookingsByProductUid(childBookings);
|
|
111
115
|
var linesByUid = indexProductsByUid(productLines);
|
|
112
116
|
var addTimeLinesByBookingUid = indexAddTimeProductsByBookingUid(productLines);
|
|
113
|
-
var claimedUids = new Set();
|
|
114
117
|
var claimedAddTimeLines = new Set();
|
|
115
|
-
|
|
116
|
-
return booking.parent_id !== 0;
|
|
117
|
-
}).reduce(function (acc, booking) {
|
|
118
|
-
var uid = booking === null || booking === void 0 ? void 0 : booking.product_uid;
|
|
118
|
+
childBookings.forEach(function (booking) {
|
|
119
119
|
var bookingUid = getBookingUid(booking);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (!claimedUids.has(key)) {
|
|
124
|
-
var line = linesByUid[key];
|
|
125
|
-
// 赠品预约只作为提交数据保留,不在购物车顶部预约卡片区展示。
|
|
126
|
-
if (isGiftProductLine(line)) return acc;
|
|
127
|
-
if (line) {
|
|
128
|
-
claimedUids.add(key);
|
|
129
|
-
product = line;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
var addTimeProduct = bookingUid ? addTimeLinesByBookingUid[bookingUid] || [] : [];
|
|
134
|
-
addTimeProduct.forEach(function (line) {
|
|
135
|
-
return claimedAddTimeLines.add(line);
|
|
120
|
+
if (!bookingUid) return;
|
|
121
|
+
(addTimeLinesByBookingUid[bookingUid] || []).forEach(function (line) {
|
|
122
|
+
claimedAddTimeLines.add(line);
|
|
136
123
|
});
|
|
137
|
-
|
|
124
|
+
});
|
|
125
|
+
var claimedBookings = new Set();
|
|
126
|
+
var cartBookings = [];
|
|
127
|
+
var items = [];
|
|
128
|
+
var orderedLines = [];
|
|
129
|
+
var buildBookingView = function buildBookingView(booking, product) {
|
|
130
|
+
var bookingUid = getBookingUid(booking);
|
|
131
|
+
var addTimeProduct = bookingUid ? addTimeLinesByBookingUid[bookingUid] || [] : [];
|
|
132
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
138
133
|
_extend: {
|
|
139
134
|
product: product,
|
|
140
135
|
addTimeProduct: addTimeProduct,
|
|
@@ -147,21 +142,38 @@ export function buildCartView(lines, bookings) {
|
|
|
147
142
|
shopOpeningHours: options.shopOpeningHours
|
|
148
143
|
})
|
|
149
144
|
}
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
var items = productLines.filter(function (line) {
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
productLines.forEach(function (line) {
|
|
154
148
|
var _line$metadata6;
|
|
155
|
-
//
|
|
156
|
-
if (isGiftProductLine(line)) return
|
|
157
|
-
if (claimedAddTimeLines.has(line)) return false;
|
|
149
|
+
// 赠品由主商品 Gift 行展示;加时商品挂在 booking._extend.addTimeProduct。
|
|
150
|
+
if (isGiftProductLine(line) || claimedAddTimeLines.has(line)) return;
|
|
158
151
|
var uid = (_line$metadata6 = line.metadata) === null || _line$metadata6 === void 0 ? void 0 : _line$metadata6.unique_identification_number;
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
var matchedBooking = uid === undefined || uid === null || uid === '' ? undefined : (bookingsByProductUid[String(uid)] || []).find(function (booking) {
|
|
153
|
+
return !claimedBookings.has(booking);
|
|
154
|
+
});
|
|
155
|
+
if (matchedBooking) {
|
|
156
|
+
claimedBookings.add(matchedBooking);
|
|
157
|
+
var bookingView = buildBookingView(matchedBooking, line);
|
|
158
|
+
cartBookings.push(bookingView);
|
|
159
|
+
orderedLines.push(bookingView);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
items.push(line);
|
|
163
|
+
orderedLines.push(line);
|
|
164
|
+
});
|
|
165
|
+
childBookings.forEach(function (booking) {
|
|
166
|
+
if (claimedBookings.has(booking)) return;
|
|
167
|
+
var uid = booking === null || booking === void 0 ? void 0 : booking.product_uid;
|
|
168
|
+
var linkedProduct = uid === undefined || uid === null || uid === '' ? null : linesByUid[String(uid)] || null;
|
|
169
|
+
// 赠品预约只作为提交数据保留,不在购物车预约卡片区展示。
|
|
170
|
+
if (isGiftProductLine(linkedProduct)) return;
|
|
171
|
+
cartBookings.push(buildBookingView(booking, null));
|
|
161
172
|
});
|
|
162
173
|
return {
|
|
163
174
|
bookings: cartBookings,
|
|
164
|
-
items: items
|
|
175
|
+
items: items,
|
|
176
|
+
lines: orderedLines
|
|
165
177
|
};
|
|
166
178
|
}
|
|
167
179
|
export function isWalkInCustomer(customer) {
|
|
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
83
83
|
private getBookingAppointmentStatus;
|
|
84
84
|
private isBookingIncludedInStats;
|
|
85
85
|
private getBookingOrderPaymentStatus;
|
|
86
|
-
private isUnpaidBooking;
|
|
87
86
|
private countBookingOrders;
|
|
88
87
|
private countCompletedBookings;
|
|
89
88
|
private groupBookingsByResource;
|
|
@@ -29,7 +29,6 @@ import dayjs from 'dayjs';
|
|
|
29
29
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
30
|
import { SalesHooks } from "./types";
|
|
31
31
|
export * from "./types";
|
|
32
|
-
var UNPAID_PAYMENT_STATUSES = new Set(['unpaid', 'partially_paid', 'payment_processing']);
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Sales 解决方案基础骨架
|
|
@@ -416,11 +415,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
416
415
|
var _booking$order$paymen, _booking$order;
|
|
417
416
|
return String((_booking$order$paymen = (_booking$order = booking.order) === null || _booking$order === void 0 ? void 0 : _booking$order.payment_status) !== null && _booking$order$paymen !== void 0 ? _booking$order$paymen : '');
|
|
418
417
|
}
|
|
419
|
-
}, {
|
|
420
|
-
key: "isUnpaidBooking",
|
|
421
|
-
value: function isUnpaidBooking(booking) {
|
|
422
|
-
return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
|
|
423
|
-
}
|
|
424
418
|
}, {
|
|
425
419
|
key: "countBookingOrders",
|
|
426
420
|
value: function countBookingOrders(bookings) {
|
|
@@ -901,11 +895,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
901
895
|
});
|
|
902
896
|
completedBookingList = matchedBookingList.filter(function (booking) {
|
|
903
897
|
return _this7.getBookingAppointmentStatus(booking) === 'completed';
|
|
904
|
-
});
|
|
905
|
-
// (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
|
|
906
|
-
// );
|
|
898
|
+
});
|
|
907
899
|
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
908
|
-
return _this7.
|
|
900
|
+
return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
|
|
909
901
|
});
|
|
910
902
|
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
|
|
911
903
|
completedBookings = completedBookingList.map(function (booking) {
|
|
@@ -41,10 +41,6 @@ import { composeLinePrice, createUuidV4, getProductSkuOptions, normalizeSubmitCo
|
|
|
41
41
|
import dayjs from 'dayjs';
|
|
42
42
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
43
43
|
export * from "./types";
|
|
44
|
-
function isItemRewardProductDiscount(discount) {
|
|
45
|
-
var _discount$metadata, _discount$metadata2;
|
|
46
|
-
return (discount === null || discount === void 0 ? void 0 : discount.type) === 'product' && (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.source) === 'promotion' && (discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.actionType) === 'ITEM_REWARD';
|
|
47
|
-
}
|
|
48
44
|
export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
49
45
|
_inherits(ScanOrderImpl, _BaseModule);
|
|
50
46
|
var _super = _createSuper(ScanOrderImpl);
|
|
@@ -1181,7 +1177,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1181
1177
|
_iterator3.s();
|
|
1182
1178
|
case 19:
|
|
1183
1179
|
if ((_step3 = _iterator3.n()).done) {
|
|
1184
|
-
_context15.next =
|
|
1180
|
+
_context15.next = 33;
|
|
1185
1181
|
break;
|
|
1186
1182
|
}
|
|
1187
1183
|
product = _step3.value;
|
|
@@ -1189,15 +1185,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1189
1185
|
_context15.next = 23;
|
|
1190
1186
|
break;
|
|
1191
1187
|
}
|
|
1192
|
-
return _context15.abrupt("continue",
|
|
1188
|
+
return _context15.abrupt("continue", 31);
|
|
1193
1189
|
case 23:
|
|
1194
|
-
if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
|
|
1195
|
-
_context15.next = 26;
|
|
1196
|
-
break;
|
|
1197
|
-
}
|
|
1198
|
-
product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
|
|
1199
|
-
return _context15.abrupt("continue", 34);
|
|
1200
|
-
case 26:
|
|
1201
1190
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1202
1191
|
var _pd$discount$resource, _pd$discount;
|
|
1203
1192
|
var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
|
|
@@ -1221,47 +1210,47 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1221
1210
|
mainPrice: newMainSellingPrice,
|
|
1222
1211
|
bundle: product.product_bundle
|
|
1223
1212
|
});
|
|
1224
|
-
case
|
|
1213
|
+
case 31:
|
|
1225
1214
|
_context15.next = 19;
|
|
1226
1215
|
break;
|
|
1227
|
-
case
|
|
1228
|
-
_context15.next =
|
|
1216
|
+
case 33:
|
|
1217
|
+
_context15.next = 38;
|
|
1229
1218
|
break;
|
|
1230
|
-
case
|
|
1231
|
-
_context15.prev =
|
|
1219
|
+
case 35:
|
|
1220
|
+
_context15.prev = 35;
|
|
1232
1221
|
_context15.t0 = _context15["catch"](17);
|
|
1233
1222
|
_iterator3.e(_context15.t0);
|
|
1234
|
-
case
|
|
1235
|
-
_context15.prev =
|
|
1223
|
+
case 38:
|
|
1224
|
+
_context15.prev = 38;
|
|
1236
1225
|
_iterator3.f();
|
|
1237
|
-
return _context15.finish(
|
|
1238
|
-
case
|
|
1226
|
+
return _context15.finish(38);
|
|
1227
|
+
case 41:
|
|
1239
1228
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1240
|
-
_context15.next =
|
|
1229
|
+
_context15.next = 44;
|
|
1241
1230
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1242
|
-
case
|
|
1231
|
+
case 44:
|
|
1243
1232
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1244
1233
|
return d.isSelected;
|
|
1245
1234
|
});
|
|
1246
|
-
_context15.next =
|
|
1235
|
+
_context15.next = 47;
|
|
1247
1236
|
return this.store.order.recalculateSummary({
|
|
1248
1237
|
createIfMissing: true
|
|
1249
1238
|
});
|
|
1250
|
-
case
|
|
1239
|
+
case 47:
|
|
1251
1240
|
this.store.order.persistTempOrder();
|
|
1252
1241
|
this.logMethodSuccess('setDiscountSelected', params);
|
|
1253
|
-
_context15.next =
|
|
1242
|
+
_context15.next = 55;
|
|
1254
1243
|
break;
|
|
1255
|
-
case
|
|
1256
|
-
_context15.prev =
|
|
1244
|
+
case 51:
|
|
1245
|
+
_context15.prev = 51;
|
|
1257
1246
|
_context15.t1 = _context15["catch"](1);
|
|
1258
1247
|
this.logMethodError('setDiscountSelected', _context15.t1);
|
|
1259
1248
|
throw _context15.t1;
|
|
1260
|
-
case
|
|
1249
|
+
case 55:
|
|
1261
1250
|
case "end":
|
|
1262
1251
|
return _context15.stop();
|
|
1263
1252
|
}
|
|
1264
|
-
}, _callee15, this, [[1,
|
|
1253
|
+
}, _callee15, this, [[1, 51], [17, 35, 38, 41]]);
|
|
1265
1254
|
}));
|
|
1266
1255
|
function setDiscountSelected(_x8) {
|
|
1267
1256
|
return _setDiscountSelected.apply(this, arguments);
|