@pisell/pisellos 2.2.267 → 2.2.269
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 +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- 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 +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +8 -0
- package/dist/modules/Order/index.d.ts +33 -13
- package/dist/modules/Order/index.js +883 -524
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +56 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.js +10 -6
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +78 -49
- package/dist/modules/Payment/types.d.ts +104 -25
- package/dist/modules/Payment/types.js +17 -0
- package/dist/modules/Payment/walletpass.d.ts +38 -1
- package/dist/modules/Payment/walletpass.js +917 -114
- package/dist/modules/Rules/index.d.ts +3 -0
- package/dist/modules/Rules/index.js +146 -106
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +1940 -1043
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +70 -4
- package/dist/server/modules/order/index.js +1816 -728
- package/dist/server/modules/order/types.d.ts +25 -3
- package/dist/server/modules/order/types.js +7 -1
- package/dist/solution/BaseSales/index.d.ts +118 -9
- package/dist/solution/BaseSales/index.js +1849 -480
- package/dist/solution/BaseSales/types.d.ts +55 -1
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingTicket/index.d.ts +8 -16
- package/dist/solution/BookingTicket/index.js +138 -52
- package/dist/solution/BookingTicket/types.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +173 -83
- package/dist/solution/Sales/index.d.ts +2 -0
- package/dist/solution/Sales/index.js +26 -4
- package/dist/solution/ScanOrder/index.js +31 -20
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +30 -19
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +5 -0
- package/lib/modules/Order/index.d.ts +33 -13
- package/lib/modules/Order/index.js +306 -79
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +56 -4
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.js +11 -4
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +33 -12
- package/lib/modules/Payment/types.d.ts +104 -25
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +38 -1
- package/lib/modules/Payment/walletpass.js +730 -21
- package/lib/modules/Rules/index.d.ts +3 -0
- package/lib/modules/Rules/index.js +54 -21
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +16 -0
- package/lib/server/index.js +670 -18
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +70 -4
- package/lib/server/modules/order/index.js +818 -69
- package/lib/server/modules/order/types.d.ts +25 -3
- package/lib/server/modules/order/types.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +118 -9
- package/lib/solution/BaseSales/index.js +902 -38
- package/lib/solution/BaseSales/types.d.ts +55 -1
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingTicket/index.d.ts +8 -16
- package/lib/solution/BookingTicket/index.js +63 -9
- package/lib/solution/BookingTicket/types.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +37 -5
- package/lib/solution/Sales/index.d.ts +2 -0
- package/lib/solution/Sales/index.js +20 -6
- package/lib/solution/ScanOrder/index.js +8 -0
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +8 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
|
@@ -337,11 +337,10 @@ 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;
|
|
341
340
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
342
341
|
while (1) switch (_context3.prev = _context3.next) {
|
|
343
342
|
case 0:
|
|
344
|
-
return _context3.abrupt("return",
|
|
343
|
+
return _context3.abrupt("return", this.loadOpenDataConfig());
|
|
345
344
|
case 1:
|
|
346
345
|
case "end":
|
|
347
346
|
return _context3.stop();
|
|
@@ -352,7 +351,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
352
351
|
return _getOpenData.apply(this, arguments);
|
|
353
352
|
}
|
|
354
353
|
return getOpenData;
|
|
355
|
-
}()
|
|
354
|
+
}() /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
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
|
+
}
|
|
356
363
|
}, {
|
|
357
364
|
key: "getShortNumberOrDeviceId",
|
|
358
365
|
value: function () {
|
|
@@ -397,49 +404,52 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
397
404
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
398
405
|
while (1) switch (_context5.prev = _context5.next) {
|
|
399
406
|
case 0:
|
|
407
|
+
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
408
|
+
this.setPaymentNumberDevicePrefix(null);
|
|
400
409
|
openDataConfig = null;
|
|
401
|
-
_context5.prev =
|
|
402
|
-
_context5.next =
|
|
410
|
+
_context5.prev = 2;
|
|
411
|
+
_context5.next = 5;
|
|
403
412
|
return this.loadOpenDataConfig();
|
|
404
|
-
case
|
|
413
|
+
case 5:
|
|
405
414
|
openDataConfig = _context5.sent;
|
|
406
|
-
_context5.next =
|
|
415
|
+
_context5.next = 12;
|
|
407
416
|
break;
|
|
408
|
-
case
|
|
409
|
-
_context5.prev =
|
|
410
|
-
_context5.t0 = _context5["catch"](
|
|
417
|
+
case 8:
|
|
418
|
+
_context5.prev = 8;
|
|
419
|
+
_context5.t0 = _context5["catch"](2);
|
|
411
420
|
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
|
|
412
421
|
return _context5.abrupt("return");
|
|
413
|
-
case
|
|
422
|
+
case 12:
|
|
414
423
|
// if (!openDataConfig) return;
|
|
415
424
|
idGenerator = this.getIdGeneratorPlugin();
|
|
416
425
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
417
|
-
_context5.next =
|
|
426
|
+
_context5.next = 16;
|
|
418
427
|
break;
|
|
419
428
|
}
|
|
420
429
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
421
430
|
return _context5.abrupt("return");
|
|
422
|
-
case
|
|
431
|
+
case 16:
|
|
423
432
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
424
433
|
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
425
434
|
prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
|
|
426
435
|
shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
|
|
427
436
|
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;
|
|
428
437
|
operatingDayBoundary = this.getAppData('operating_day_boundary');
|
|
429
|
-
_context5.next =
|
|
438
|
+
_context5.next = 24;
|
|
430
439
|
return this.getShortNumberOrDeviceId();
|
|
431
|
-
case
|
|
440
|
+
case 24:
|
|
432
441
|
deviceId = _context5.sent;
|
|
442
|
+
this.setPaymentNumberDevicePrefix(deviceId);
|
|
433
443
|
businessCode = this.getBookingTicketBusinessCode();
|
|
434
444
|
if (businessCode) {
|
|
435
|
-
_context5.next =
|
|
445
|
+
_context5.next = 30;
|
|
436
446
|
break;
|
|
437
447
|
}
|
|
438
448
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
439
449
|
return _context5.abrupt("return");
|
|
440
|
-
case
|
|
441
|
-
_context5.prev =
|
|
442
|
-
_context5.next =
|
|
450
|
+
case 30:
|
|
451
|
+
_context5.prev = 30;
|
|
452
|
+
_context5.next = 33;
|
|
443
453
|
return idGenerator.configure({
|
|
444
454
|
biz: businessCode,
|
|
445
455
|
config: {
|
|
@@ -454,18 +464,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
454
464
|
shopOrderPrefix: shopOrderPrefix
|
|
455
465
|
}
|
|
456
466
|
});
|
|
457
|
-
case 31:
|
|
458
|
-
_context5.next = 36;
|
|
459
|
-
break;
|
|
460
467
|
case 33:
|
|
461
|
-
_context5.
|
|
462
|
-
|
|
468
|
+
_context5.next = 38;
|
|
469
|
+
break;
|
|
470
|
+
case 35:
|
|
471
|
+
_context5.prev = 35;
|
|
472
|
+
_context5.t1 = _context5["catch"](30);
|
|
463
473
|
console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
|
|
464
|
-
case
|
|
474
|
+
case 38:
|
|
465
475
|
case "end":
|
|
466
476
|
return _context5.stop();
|
|
467
477
|
}
|
|
468
|
-
}, _callee5, this, [[
|
|
478
|
+
}, _callee5, this, [[2, 8], [30, 35]]);
|
|
469
479
|
}));
|
|
470
480
|
function configureIdGeneratorFromOpenData() {
|
|
471
481
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -592,12 +602,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
592
602
|
tempOrder: tempOrder
|
|
593
603
|
});
|
|
594
604
|
case 18:
|
|
595
|
-
return _context7.abrupt("return", {
|
|
596
|
-
isAvailable: raw.isAvailable
|
|
605
|
+
return _context7.abrupt("return", _objectSpread(_objectSpread({
|
|
606
|
+
isAvailable: raw.isAvailable
|
|
607
|
+
}, raw.isAccepted !== undefined ? {
|
|
608
|
+
isAccepted: raw.isAccepted
|
|
609
|
+
} : {}), {}, {
|
|
597
610
|
type: raw.type,
|
|
598
611
|
unavailableReason: raw.unavailableReason,
|
|
599
612
|
scannedDiscountList: raw.scannedDiscountList
|
|
600
|
-
});
|
|
613
|
+
}));
|
|
601
614
|
case 19:
|
|
602
615
|
case "end":
|
|
603
616
|
return _context7.stop();
|
|
@@ -1260,24 +1273,88 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1260
1273
|
}
|
|
1261
1274
|
|
|
1262
1275
|
/**
|
|
1263
|
-
* 通过 ids
|
|
1264
|
-
*
|
|
1276
|
+
* 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
|
|
1277
|
+
* 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
|
|
1265
1278
|
*/
|
|
1266
1279
|
}, {
|
|
1267
1280
|
key: "getProductByIds",
|
|
1268
1281
|
value: (function () {
|
|
1269
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
|
|
1282
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids, options) {
|
|
1283
|
+
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1284
|
+
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1270
1285
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1271
1286
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1272
1287
|
case 0:
|
|
1273
|
-
|
|
1274
|
-
|
|
1288
|
+
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1289
|
+
return Number(id);
|
|
1290
|
+
}).filter(function (id) {
|
|
1291
|
+
return Number.isFinite(id);
|
|
1292
|
+
})));
|
|
1293
|
+
_context18.next = 3;
|
|
1294
|
+
return this.store.products.getProductByIds(normalizedIds);
|
|
1295
|
+
case 3:
|
|
1296
|
+
_context18.t0 = _context18.sent;
|
|
1297
|
+
if (_context18.t0) {
|
|
1298
|
+
_context18.next = 6;
|
|
1299
|
+
break;
|
|
1300
|
+
}
|
|
1301
|
+
_context18.t0 = [];
|
|
1302
|
+
case 6:
|
|
1303
|
+
localProducts = _context18.t0;
|
|
1304
|
+
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1305
|
+
_context18.next = 9;
|
|
1306
|
+
break;
|
|
1307
|
+
}
|
|
1308
|
+
return _context18.abrupt("return", localProducts);
|
|
1309
|
+
case 9:
|
|
1310
|
+
localProductIds = new Set(localProducts.map(function (product) {
|
|
1311
|
+
return Number(product.id);
|
|
1312
|
+
}));
|
|
1313
|
+
missingIds = normalizedIds.filter(function (id) {
|
|
1314
|
+
return !localProductIds.has(id);
|
|
1315
|
+
});
|
|
1316
|
+
if (missingIds.length) {
|
|
1317
|
+
_context18.next = 13;
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
1320
|
+
return _context18.abrupt("return", localProducts);
|
|
1321
|
+
case 13:
|
|
1322
|
+
rawBookingDate = this.getBookingDate();
|
|
1323
|
+
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1324
|
+
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);
|
|
1325
|
+
_context18.next = 18;
|
|
1326
|
+
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1327
|
+
product_ids: missingIds,
|
|
1328
|
+
with_count: ['bundleGroup', 'optionGroup'],
|
|
1329
|
+
with_schedule: 1,
|
|
1330
|
+
cacheId: this.cacheId
|
|
1331
|
+
}, bookingDate ? {
|
|
1332
|
+
schedule_date: bookingDate.format('YYYY-MM-DD'),
|
|
1333
|
+
schedule_datetime: bookingDate.format('YYYY-MM-DD HH:mm:ss')
|
|
1334
|
+
} : {}), Number.isFinite(customerId) && customerId > 0 ? {
|
|
1335
|
+
customer_id: customerId
|
|
1336
|
+
} : {}));
|
|
1337
|
+
case 18:
|
|
1338
|
+
loadedProducts = _context18.sent;
|
|
1339
|
+
productById = new Map();
|
|
1340
|
+
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1341
|
+
var productId = Number(product.id);
|
|
1342
|
+
if (Number.isFinite(productId)) {
|
|
1343
|
+
productById.set(productId, product);
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
return _context18.abrupt("return", normalizedIds.map(function (id) {
|
|
1347
|
+
return productById.get(id);
|
|
1348
|
+
}).filter(function (product) {
|
|
1349
|
+
return Boolean(product);
|
|
1350
|
+
}));
|
|
1351
|
+
case 22:
|
|
1275
1352
|
case "end":
|
|
1276
1353
|
return _context18.stop();
|
|
1277
1354
|
}
|
|
1278
1355
|
}, _callee18, this);
|
|
1279
1356
|
}));
|
|
1280
|
-
function getProductByIds(_x13) {
|
|
1357
|
+
function getProductByIds(_x13, _x14) {
|
|
1281
1358
|
return _getProductByIds.apply(this, arguments);
|
|
1282
1359
|
}
|
|
1283
1360
|
return getProductByIds;
|
|
@@ -1311,7 +1388,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1311
1388
|
}
|
|
1312
1389
|
}, _callee19, this);
|
|
1313
1390
|
}));
|
|
1314
|
-
function getScheduleTimePoints(
|
|
1391
|
+
function getScheduleTimePoints(_x15) {
|
|
1315
1392
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
1316
1393
|
}
|
|
1317
1394
|
return getScheduleTimePoints;
|
|
@@ -1701,7 +1778,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1701
1778
|
}
|
|
1702
1779
|
}, _callee23, this, [[0, 7]]);
|
|
1703
1780
|
}));
|
|
1704
|
-
function changeCustomerPage(
|
|
1781
|
+
function changeCustomerPage(_x16, _x17) {
|
|
1705
1782
|
return _changeCustomerPage.apply(this, arguments);
|
|
1706
1783
|
}
|
|
1707
1784
|
return changeCustomerPage;
|
|
@@ -1993,7 +2070,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1993
2070
|
}, {
|
|
1994
2071
|
key: "getBookingConfig",
|
|
1995
2072
|
value: function getBookingConfig() {
|
|
1996
|
-
|
|
2073
|
+
var _this$store$bookingCo;
|
|
2074
|
+
return (_this$store$bookingCo = this.store.bookingContext) === null || _this$store$bookingCo === void 0 ? void 0 : _this$store$bookingCo.getBookingConfig();
|
|
1997
2075
|
}
|
|
1998
2076
|
|
|
1999
2077
|
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
@@ -2154,10 +2232,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2154
2232
|
}, {
|
|
2155
2233
|
key: "buildAddProductCtx",
|
|
2156
2234
|
value: function buildAddProductCtx(extra) {
|
|
2157
|
-
var _extra$date2, _ref12, _this$
|
|
2235
|
+
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get4, _extra$presetStartTim2;
|
|
2158
2236
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2159
2237
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2160
|
-
var orderCustomerId = (_ref12 = (_this$
|
|
2238
|
+
var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_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;
|
|
2161
2239
|
return _objectSpread({
|
|
2162
2240
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2163
2241
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2274,7 +2352,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2274
2352
|
}
|
|
2275
2353
|
}, _callee27, this);
|
|
2276
2354
|
}));
|
|
2277
|
-
function updateProductInOrder(
|
|
2355
|
+
function updateProductInOrder(_x18) {
|
|
2278
2356
|
return _updateProductInOrder.apply(this, arguments);
|
|
2279
2357
|
}
|
|
2280
2358
|
return updateProductInOrder;
|
|
@@ -2362,6 +2440,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2362
2440
|
},
|
|
2363
2441
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2364
2442
|
return _this6.addProductToOrder(product, booking);
|
|
2443
|
+
},
|
|
2444
|
+
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2445
|
+
return _this6.refreshWalletAssets(params);
|
|
2446
|
+
},
|
|
2447
|
+
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2448
|
+
return _this6.scanWalletAsset(scanCode);
|
|
2365
2449
|
}
|
|
2366
2450
|
}, formatted, bridge);
|
|
2367
2451
|
case 16:
|
|
@@ -2383,7 +2467,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2383
2467
|
}
|
|
2384
2468
|
}, _callee28, this, [[4, 21]]);
|
|
2385
2469
|
}));
|
|
2386
|
-
function handleGlobalScanCode(
|
|
2470
|
+
function handleGlobalScanCode(_x19, _x20) {
|
|
2387
2471
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2388
2472
|
}
|
|
2389
2473
|
return handleGlobalScanCode;
|
|
@@ -2481,7 +2565,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2481
2565
|
}
|
|
2482
2566
|
}, _callee29, this);
|
|
2483
2567
|
}));
|
|
2484
|
-
function addAddTimeProductToBooking(
|
|
2568
|
+
function addAddTimeProductToBooking(_x21) {
|
|
2485
2569
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
2486
2570
|
}
|
|
2487
2571
|
return addAddTimeProductToBooking;
|
|
@@ -2584,7 +2668,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2584
2668
|
}
|
|
2585
2669
|
}, _callee30, this, [[13, 31, 34, 37]]);
|
|
2586
2670
|
}));
|
|
2587
|
-
function addAddTimeProductsToBooking(
|
|
2671
|
+
function addAddTimeProductsToBooking(_x22) {
|
|
2588
2672
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
2589
2673
|
}
|
|
2590
2674
|
return addAddTimeProductsToBooking;
|
|
@@ -2601,22 +2685,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2601
2685
|
while (1) switch (_context31.prev = _context31.next) {
|
|
2602
2686
|
case 0:
|
|
2603
2687
|
_ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
2604
|
-
|
|
2688
|
+
_context31.next = 3;
|
|
2689
|
+
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
2605
2690
|
cover: cover
|
|
2606
2691
|
});
|
|
2607
|
-
|
|
2608
|
-
|
|
2692
|
+
case 3:
|
|
2693
|
+
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
2694
|
+
_context31.next = 6;
|
|
2609
2695
|
break;
|
|
2610
2696
|
}
|
|
2611
|
-
_context31.next =
|
|
2697
|
+
_context31.next = 6;
|
|
2612
2698
|
return this.configureIdGeneratorFromOpenData();
|
|
2613
|
-
case
|
|
2699
|
+
case 6:
|
|
2614
2700
|
case "end":
|
|
2615
2701
|
return _context31.stop();
|
|
2616
2702
|
}
|
|
2617
2703
|
}, _callee31, this);
|
|
2618
2704
|
}));
|
|
2619
|
-
function setOtherParams(
|
|
2705
|
+
function setOtherParams(_x23) {
|
|
2620
2706
|
return _setOtherParams.apply(this, arguments);
|
|
2621
2707
|
}
|
|
2622
2708
|
return setOtherParams;
|
|
@@ -2687,7 +2773,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2687
2773
|
}
|
|
2688
2774
|
}, _callee32, this);
|
|
2689
2775
|
}));
|
|
2690
|
-
function handlePrintWristband(
|
|
2776
|
+
function handlePrintWristband(_x24) {
|
|
2691
2777
|
return _handlePrintWristband.apply(this, arguments);
|
|
2692
2778
|
}
|
|
2693
2779
|
return handlePrintWristband;
|
|
@@ -2762,7 +2848,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2762
2848
|
}
|
|
2763
2849
|
}, _callee33, this);
|
|
2764
2850
|
}));
|
|
2765
|
-
function handleRedeem(
|
|
2851
|
+
function handleRedeem(_x25) {
|
|
2766
2852
|
return _handleRedeem.apply(this, arguments);
|
|
2767
2853
|
}
|
|
2768
2854
|
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 的客户展示视图。
|
|
@@ -229,6 +232,7 @@ export interface GlobalScanHostBridge {
|
|
|
229
232
|
*/
|
|
230
233
|
applyPromotionCode?: (code: string, customerId?: number) => Promise<{
|
|
231
234
|
isAvailable?: boolean;
|
|
235
|
+
isAccepted?: boolean;
|
|
232
236
|
type?: string;
|
|
233
237
|
unavailableReason?: string;
|
|
234
238
|
}>;
|
|
@@ -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) {
|
|
@@ -24,6 +24,14 @@ export interface GlobalScanApplyHost {
|
|
|
24
24
|
cacheItem: any;
|
|
25
25
|
};
|
|
26
26
|
addProductToOrder(product: any, booking?: any): Promise<any>;
|
|
27
|
+
refreshWalletAssets?(params?: {
|
|
28
|
+
preserveSelection?: boolean;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
scanWalletAsset?(code: string): Promise<{
|
|
31
|
+
type: 'walletCode' | 'normalCode';
|
|
32
|
+
asset?: any;
|
|
33
|
+
selected: boolean;
|
|
34
|
+
}>;
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
37
|
* 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
|