@pisell/pisellos 0.10.41 → 0.10.43
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/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +39 -13
- package/dist/modules/Discount/types.d.ts +26 -5
- package/dist/modules/Order/index.d.ts +5 -0
- package/dist/modules/Order/index.js +283 -118
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.js +17 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
- package/dist/modules/ResourcePlanner/planner.js +163 -46
- package/dist/modules/ResourcePlanner/types.d.ts +17 -0
- package/dist/modules/Rules/index.js +312 -135
- package/dist/solution/BaseSales/index.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +9 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +171 -96
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +12 -3
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +41 -21
- package/dist/solution/ShopDiscount/utils.js +3 -2
- package/dist/solution/UnifiedBookingSales/index.js +94 -21
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +25 -9
- package/lib/modules/Discount/types.d.ts +26 -5
- package/lib/modules/Order/index.d.ts +5 -0
- package/lib/modules/Order/index.js +172 -28
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.js +19 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
- package/lib/modules/ResourcePlanner/planner.js +137 -35
- package/lib/modules/ResourcePlanner/types.d.ts +17 -0
- package/lib/modules/Rules/index.js +232 -97
- package/lib/solution/BaseSales/index.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +7 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +65 -18
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -1
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +5 -1
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +26 -6
- package/lib/solution/ShopDiscount/utils.js +3 -2
- package/lib/solution/UnifiedBookingSales/index.js +86 -22
- package/package.json +1 -1
|
@@ -206,35 +206,27 @@ export function applyGlobalScan(_x14, _x15, _x16) {
|
|
|
206
206
|
}
|
|
207
207
|
function _applyGlobalScan() {
|
|
208
208
|
_applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(host, formatted, bridge) {
|
|
209
|
-
var searchType, data, scanCode, formattedCustomerId, isCrossShopWallet, _getRealCustomerId, _bridge$
|
|
209
|
+
var searchType, data, scanCode, formattedCustomerId, isCrossShopWallet, isWalletPassUnavailableAtStore, _getRealCustomerId, _bridge$onNotify5, currentCustomer, currentCustomerId, _customer, sourceCustomerId, _bridge$onNotify, _bridge$onNotify2, _customerId, _bridge$onNotify3, orderCustomer, switched, _bridge$onNotify4, _promotionResult$isAc, _bridge$onNotify6, snapshot, activeCustomer, bindWalletPassCustomer, trySelectWalletAsset, bindResult, walletSelection, promotionCustomerId, promotionResult, list, _bridge$onNotify12, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify13, _data$order_id, _data$business_code, orderId, _bridge$onNotify14;
|
|
210
210
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
211
211
|
while (1) switch (_context6.prev = _context6.next) {
|
|
212
212
|
case 0:
|
|
213
|
-
searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode, formattedCustomerId = formatted.customerId, isCrossShopWallet = formatted.isCrossShopWallet;
|
|
213
|
+
searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode, formattedCustomerId = formatted.customerId, isCrossShopWallet = formatted.isCrossShopWallet, isWalletPassUnavailableAtStore = formatted.isWalletPassUnavailableAtStore;
|
|
214
214
|
if (!(searchType === 'wallet')) {
|
|
215
|
-
_context6.next =
|
|
215
|
+
_context6.next = 44;
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
218
218
|
currentCustomer = host.getOrderCustomerSnapshot();
|
|
219
|
-
|
|
220
|
-
_context6.next = 5;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
return _context6.abrupt("return", {
|
|
224
|
-
status: 'success',
|
|
225
|
-
kind: 'customer'
|
|
226
|
-
});
|
|
227
|
-
case 5:
|
|
219
|
+
currentCustomerId = getRealCustomerId(currentCustomer);
|
|
228
220
|
_customer = data;
|
|
229
221
|
if (!isCrossShopWallet) {
|
|
230
|
-
_context6.next =
|
|
222
|
+
_context6.next = 20;
|
|
231
223
|
break;
|
|
232
224
|
}
|
|
233
225
|
sourceCustomerId = getRealCustomerId({
|
|
234
226
|
id: formattedCustomerId
|
|
235
227
|
});
|
|
236
228
|
if (!(sourceCustomerId === undefined || !host.resolveCustomerById)) {
|
|
237
|
-
_context6.next =
|
|
229
|
+
_context6.next = 10;
|
|
238
230
|
break;
|
|
239
231
|
}
|
|
240
232
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -242,28 +234,28 @@ function _applyGlobalScan() {
|
|
|
242
234
|
status: 'failed',
|
|
243
235
|
reason: 'invalid_data'
|
|
244
236
|
});
|
|
245
|
-
case
|
|
246
|
-
_context6.prev =
|
|
247
|
-
_context6.next =
|
|
237
|
+
case 10:
|
|
238
|
+
_context6.prev = 10;
|
|
239
|
+
_context6.next = 13;
|
|
248
240
|
return host.resolveCustomerById(sourceCustomerId);
|
|
249
|
-
case
|
|
241
|
+
case 13:
|
|
250
242
|
_customer = _context6.sent;
|
|
251
|
-
_context6.next =
|
|
243
|
+
_context6.next = 20;
|
|
252
244
|
break;
|
|
253
|
-
case
|
|
254
|
-
_context6.prev =
|
|
255
|
-
_context6.t0 = _context6["catch"](
|
|
245
|
+
case 16:
|
|
246
|
+
_context6.prev = 16;
|
|
247
|
+
_context6.t0 = _context6["catch"](10);
|
|
256
248
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', getErrorMessage(_context6.t0) || 'pisell2.text.scan-global-failed');
|
|
257
249
|
return _context6.abrupt("return", {
|
|
258
250
|
status: 'failed',
|
|
259
251
|
reason: 'invalid_data'
|
|
260
252
|
});
|
|
261
|
-
case
|
|
253
|
+
case 20:
|
|
262
254
|
_customerId = (_getRealCustomerId = getRealCustomerId(_customer)) !== null && _getRealCustomerId !== void 0 ? _getRealCustomerId : !isCrossShopWallet ? getRealCustomerId({
|
|
263
255
|
id: formattedCustomerId
|
|
264
256
|
}) : undefined;
|
|
265
257
|
if (!(!_customer || _customerId === undefined)) {
|
|
266
|
-
_context6.next =
|
|
258
|
+
_context6.next = 24;
|
|
267
259
|
break;
|
|
268
260
|
}
|
|
269
261
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -271,37 +263,89 @@ function _applyGlobalScan() {
|
|
|
271
263
|
status: 'failed',
|
|
272
264
|
reason: 'invalid_data'
|
|
273
265
|
});
|
|
274
|
-
case
|
|
266
|
+
case 24:
|
|
275
267
|
orderCustomer = _customer.id === undefined || _customer.id === null ? _objectSpread(_objectSpread({}, _customer), {}, {
|
|
276
268
|
id: _customerId
|
|
277
269
|
}) : _customer;
|
|
270
|
+
if (!(currentCustomerId === _customerId)) {
|
|
271
|
+
_context6.next = 27;
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
return _context6.abrupt("return", {
|
|
275
|
+
status: 'success',
|
|
276
|
+
kind: 'customer'
|
|
277
|
+
});
|
|
278
|
+
case 27:
|
|
279
|
+
if (!(currentCustomerId !== undefined)) {
|
|
280
|
+
_context6.next = 41;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
if (bridge !== null && bridge !== void 0 && bridge.requestCustomerSwitch) {
|
|
284
|
+
_context6.next = 30;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
return _context6.abrupt("return", {
|
|
288
|
+
status: 'success',
|
|
289
|
+
kind: 'customer'
|
|
290
|
+
});
|
|
291
|
+
case 30:
|
|
292
|
+
_context6.prev = 30;
|
|
293
|
+
_context6.next = 33;
|
|
294
|
+
return bridge.requestCustomerSwitch(orderCustomer);
|
|
295
|
+
case 33:
|
|
296
|
+
switched = _context6.sent;
|
|
297
|
+
return _context6.abrupt("return", switched ? {
|
|
298
|
+
status: 'success',
|
|
299
|
+
kind: 'customer'
|
|
300
|
+
} : {
|
|
301
|
+
status: 'cancelled'
|
|
302
|
+
});
|
|
303
|
+
case 37:
|
|
304
|
+
_context6.prev = 37;
|
|
305
|
+
_context6.t1 = _context6["catch"](30);
|
|
306
|
+
(_bridge$onNotify4 = bridge.onNotify) === null || _bridge$onNotify4 === void 0 || _bridge$onNotify4.call(bridge, 'fail', getErrorMessage(_context6.t1) || 'pisell2.text.scan-global-failed');
|
|
307
|
+
return _context6.abrupt("return", {
|
|
308
|
+
status: 'failed',
|
|
309
|
+
reason: 'invalid_data'
|
|
310
|
+
});
|
|
311
|
+
case 41:
|
|
278
312
|
host.setOrderCustomer(orderCustomer);
|
|
279
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
313
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'success', 'pisell2.text.add-client-success');
|
|
280
314
|
return _context6.abrupt("return", {
|
|
281
315
|
status: 'success',
|
|
282
316
|
kind: 'customer'
|
|
283
317
|
});
|
|
284
|
-
case
|
|
318
|
+
case 44:
|
|
285
319
|
if (!(searchType === 'walletPass')) {
|
|
286
|
-
_context6.next =
|
|
320
|
+
_context6.next = 78;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
if (!isWalletPassUnavailableAtStore) {
|
|
324
|
+
_context6.next = 48;
|
|
287
325
|
break;
|
|
288
326
|
}
|
|
327
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'fail', 'pisell2.text.wallet-pass-not-available-at-store');
|
|
328
|
+
return _context6.abrupt("return", {
|
|
329
|
+
status: 'failed',
|
|
330
|
+
reason: 'invalid_data'
|
|
331
|
+
});
|
|
332
|
+
case 48:
|
|
289
333
|
snapshot = host.getOrderCustomerSnapshot();
|
|
290
|
-
currentCustomerIsWalkIn = getRealCustomerId(snapshot) === undefined;
|
|
291
334
|
activeCustomer = snapshot;
|
|
292
335
|
bindWalletPassCustomer = /*#__PURE__*/function () {
|
|
293
336
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(asset) {
|
|
294
337
|
var _getWalletAssetCustom, _host$refreshWalletAs;
|
|
295
|
-
var assetCustomerId, customer, _bridge$
|
|
338
|
+
var assetCustomerId, customer, _bridge$onNotify7, _bridge$onNotify8, customerId, _bridge$onNotify9, orderCustomer;
|
|
296
339
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
297
340
|
while (1) switch (_context4.prev = _context4.next) {
|
|
298
341
|
case 0:
|
|
299
|
-
if (
|
|
342
|
+
if (!(getRealCustomerId(activeCustomer) !== undefined)) {
|
|
300
343
|
_context4.next = 2;
|
|
301
344
|
break;
|
|
302
345
|
}
|
|
303
346
|
return _context4.abrupt("return", {
|
|
304
|
-
resolveFailed: false
|
|
347
|
+
resolveFailed: false,
|
|
348
|
+
customerBound: false
|
|
305
349
|
});
|
|
306
350
|
case 2:
|
|
307
351
|
assetCustomerId = (_getWalletAssetCustom = getWalletAssetCustomerId(asset)) !== null && _getWalletAssetCustom !== void 0 ? _getWalletAssetCustom : getRealCustomerId({
|
|
@@ -316,9 +360,10 @@ function _applyGlobalScan() {
|
|
|
316
360
|
_context4.next = 8;
|
|
317
361
|
break;
|
|
318
362
|
}
|
|
319
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
363
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
320
364
|
return _context4.abrupt("return", {
|
|
321
|
-
resolveFailed: true
|
|
365
|
+
resolveFailed: true,
|
|
366
|
+
customerBound: false
|
|
322
367
|
});
|
|
323
368
|
case 8:
|
|
324
369
|
_context4.prev = 8;
|
|
@@ -332,9 +377,10 @@ function _applyGlobalScan() {
|
|
|
332
377
|
_context4.prev = 14;
|
|
333
378
|
_context4.t0 = _context4["catch"](8);
|
|
334
379
|
console.warn('[GlobalScan] Wallet asset customer lookup failed', _context4.t0);
|
|
335
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
380
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify8 = bridge.onNotify) === null || _bridge$onNotify8 === void 0 || _bridge$onNotify8.call(bridge, 'fail', getErrorMessage(_context4.t0) || 'pisell2.text.scan-global-failed');
|
|
336
381
|
return _context4.abrupt("return", {
|
|
337
|
-
resolveFailed: true
|
|
382
|
+
resolveFailed: true,
|
|
383
|
+
customerBound: false
|
|
338
384
|
});
|
|
339
385
|
case 19:
|
|
340
386
|
customerId = getRealCustomerId(customer);
|
|
@@ -343,10 +389,11 @@ function _applyGlobalScan() {
|
|
|
343
389
|
break;
|
|
344
390
|
}
|
|
345
391
|
if (assetCustomerId !== undefined) {
|
|
346
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
392
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify9 = bridge.onNotify) === null || _bridge$onNotify9 === void 0 || _bridge$onNotify9.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
347
393
|
}
|
|
348
394
|
return _context4.abrupt("return", {
|
|
349
|
-
resolveFailed: assetCustomerId !== undefined
|
|
395
|
+
resolveFailed: assetCustomerId !== undefined,
|
|
396
|
+
customerBound: false
|
|
350
397
|
});
|
|
351
398
|
case 23:
|
|
352
399
|
orderCustomer = customer.id === undefined || customer.id === null ? _objectSpread(_objectSpread({}, customer), {}, {
|
|
@@ -361,7 +408,8 @@ function _applyGlobalScan() {
|
|
|
361
408
|
});
|
|
362
409
|
case 28:
|
|
363
410
|
return _context4.abrupt("return", {
|
|
364
|
-
resolveFailed: false
|
|
411
|
+
resolveFailed: false,
|
|
412
|
+
customerBound: true
|
|
365
413
|
});
|
|
366
414
|
case 29:
|
|
367
415
|
case "end":
|
|
@@ -375,7 +423,7 @@ function _applyGlobalScan() {
|
|
|
375
423
|
}();
|
|
376
424
|
trySelectWalletAsset = /*#__PURE__*/function () {
|
|
377
425
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
378
|
-
var walletResult, bindResult, _bridge$
|
|
426
|
+
var walletResult, bindResult, _bridge$onNotify10, _bridge$onNotify11;
|
|
379
427
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
380
428
|
while (1) switch (_context5.prev = _context5.next) {
|
|
381
429
|
case 0:
|
|
@@ -413,7 +461,7 @@ function _applyGlobalScan() {
|
|
|
413
461
|
break;
|
|
414
462
|
}
|
|
415
463
|
if (!bindResult.resolveFailed) {
|
|
416
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
464
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify10 = bridge.onNotify) === null || _bridge$onNotify10 === void 0 || _bridge$onNotify10.call(bridge, 'success');
|
|
417
465
|
}
|
|
418
466
|
return _context5.abrupt("return", {
|
|
419
467
|
status: 'success',
|
|
@@ -422,7 +470,7 @@ function _applyGlobalScan() {
|
|
|
422
470
|
case 15:
|
|
423
471
|
// 已识别为 Wallet 支付资产但当前不可用:保留禁用展示,不回退优惠码。
|
|
424
472
|
if (!bindResult.resolveFailed) {
|
|
425
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
473
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify11 = bridge.onNotify) === null || _bridge$onNotify11 === void 0 || _bridge$onNotify11.call(bridge, 'fail', 'pisell2.text.goodpass.code-invalid-cart');
|
|
426
474
|
}
|
|
427
475
|
return _context5.abrupt("return", {
|
|
428
476
|
status: 'failed',
|
|
@@ -437,115 +485,142 @@ function _applyGlobalScan() {
|
|
|
437
485
|
return function trySelectWalletAsset() {
|
|
438
486
|
return _ref3.apply(this, arguments);
|
|
439
487
|
};
|
|
440
|
-
}();
|
|
441
|
-
|
|
488
|
+
}(); // batch-search 可能返回来源门店客户;先映射到当前门店,确保 Wallet
|
|
489
|
+
// 支付资产查询使用本店客户上下文。
|
|
490
|
+
_context6.next = 54;
|
|
491
|
+
return bindWalletPassCustomer();
|
|
492
|
+
case 54:
|
|
493
|
+
bindResult = _context6.sent;
|
|
494
|
+
_context6.next = 57;
|
|
442
495
|
return trySelectWalletAsset();
|
|
443
|
-
case
|
|
496
|
+
case 57:
|
|
444
497
|
walletSelection = _context6.sent;
|
|
445
498
|
if (!walletSelection) {
|
|
446
|
-
_context6.next =
|
|
499
|
+
_context6.next = 60;
|
|
447
500
|
break;
|
|
448
501
|
}
|
|
449
502
|
return _context6.abrupt("return", walletSelection);
|
|
450
|
-
case
|
|
451
|
-
_context6.next = 42;
|
|
452
|
-
return bindWalletPassCustomer();
|
|
453
|
-
case 42:
|
|
503
|
+
case 60:
|
|
454
504
|
if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
|
|
455
|
-
_context6.next =
|
|
505
|
+
_context6.next = 62;
|
|
456
506
|
break;
|
|
457
507
|
}
|
|
458
508
|
return _context6.abrupt("return", {
|
|
459
509
|
status: 'failed',
|
|
460
510
|
reason: 'no_bridge'
|
|
461
511
|
});
|
|
462
|
-
case
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
512
|
+
case 62:
|
|
513
|
+
promotionCustomerId = getRealCustomerId(activeCustomer);
|
|
514
|
+
if (!bindResult.customerBound) {
|
|
515
|
+
_context6.next = 69;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
_context6.next = 66;
|
|
519
|
+
return bridge.applyPromotionCode(scanCode, promotionCustomerId, {
|
|
520
|
+
suppressFailureNotification: true
|
|
521
|
+
});
|
|
522
|
+
case 66:
|
|
523
|
+
_context6.t2 = _context6.sent;
|
|
524
|
+
_context6.next = 72;
|
|
525
|
+
break;
|
|
526
|
+
case 69:
|
|
527
|
+
_context6.next = 71;
|
|
528
|
+
return bridge.applyPromotionCode(scanCode, promotionCustomerId);
|
|
529
|
+
case 71:
|
|
530
|
+
_context6.t2 = _context6.sent;
|
|
531
|
+
case 72:
|
|
532
|
+
promotionResult = _context6.t2;
|
|
467
533
|
if (!((_promotionResult$isAc = promotionResult === null || promotionResult === void 0 ? void 0 : promotionResult.isAccepted) !== null && _promotionResult$isAc !== void 0 ? _promotionResult$isAc : promotionResult === null || promotionResult === void 0 ? void 0 : promotionResult.isAvailable)) {
|
|
468
|
-
_context6.next =
|
|
534
|
+
_context6.next = 75;
|
|
469
535
|
break;
|
|
470
536
|
}
|
|
471
537
|
return _context6.abrupt("return", {
|
|
472
538
|
status: 'success',
|
|
473
539
|
kind: 'promotion'
|
|
474
540
|
});
|
|
475
|
-
case
|
|
541
|
+
case 75:
|
|
542
|
+
if (!bindResult.customerBound) {
|
|
543
|
+
_context6.next = 77;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
return _context6.abrupt("return", {
|
|
547
|
+
status: 'success',
|
|
548
|
+
kind: 'customer'
|
|
549
|
+
});
|
|
550
|
+
case 77:
|
|
476
551
|
return _context6.abrupt("return", {
|
|
477
552
|
status: 'failed',
|
|
478
553
|
reason: 'invalid_data'
|
|
479
554
|
});
|
|
480
|
-
case
|
|
555
|
+
case 78:
|
|
481
556
|
if (!(searchType === 'product' || searchType === 'local_product')) {
|
|
482
|
-
_context6.next =
|
|
557
|
+
_context6.next = 111;
|
|
483
558
|
break;
|
|
484
559
|
}
|
|
485
560
|
list = data === null || data === void 0 ? void 0 : data.list;
|
|
486
561
|
if (!(!Array.isArray(list) || list.length === 0)) {
|
|
487
|
-
_context6.next =
|
|
562
|
+
_context6.next = 83;
|
|
488
563
|
break;
|
|
489
564
|
}
|
|
490
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
565
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify12 = bridge.onNotify) === null || _bridge$onNotify12 === void 0 || _bridge$onNotify12.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
491
566
|
return _context6.abrupt("return", {
|
|
492
567
|
status: 'failed',
|
|
493
568
|
reason: 'invalid_data'
|
|
494
569
|
});
|
|
495
|
-
case
|
|
570
|
+
case 83:
|
|
496
571
|
addedCount = 0;
|
|
497
572
|
_iterator = _createForOfIteratorHelper(list);
|
|
498
|
-
_context6.prev =
|
|
573
|
+
_context6.prev = 85;
|
|
499
574
|
_iterator.s();
|
|
500
|
-
case
|
|
575
|
+
case 87:
|
|
501
576
|
if ((_step = _iterator.n()).done) {
|
|
502
|
-
_context6.next =
|
|
577
|
+
_context6.next = 99;
|
|
503
578
|
break;
|
|
504
579
|
}
|
|
505
580
|
_item = _step.value;
|
|
506
|
-
_context6.next =
|
|
581
|
+
_context6.next = 91;
|
|
507
582
|
return processScannedProductItem(host, _item, scanCode, bridge);
|
|
508
|
-
case
|
|
583
|
+
case 91:
|
|
509
584
|
outcome = _context6.sent;
|
|
510
585
|
if (outcome === 'added') {
|
|
511
586
|
addedCount += 1;
|
|
512
587
|
}
|
|
513
588
|
if (!(outcome === 'cancelled')) {
|
|
514
|
-
_context6.next =
|
|
589
|
+
_context6.next = 95;
|
|
515
590
|
break;
|
|
516
591
|
}
|
|
517
592
|
return _context6.abrupt("return", {
|
|
518
593
|
status: 'cancelled'
|
|
519
594
|
});
|
|
520
|
-
case
|
|
595
|
+
case 95:
|
|
521
596
|
if (!(outcome === 'pending')) {
|
|
522
|
-
_context6.next =
|
|
597
|
+
_context6.next = 97;
|
|
523
598
|
break;
|
|
524
599
|
}
|
|
525
600
|
return _context6.abrupt("return", {
|
|
526
601
|
status: 'pending',
|
|
527
602
|
kind: 'requiresDetail'
|
|
528
603
|
});
|
|
529
|
-
case
|
|
530
|
-
_context6.next =
|
|
604
|
+
case 97:
|
|
605
|
+
_context6.next = 87;
|
|
531
606
|
break;
|
|
532
|
-
case
|
|
533
|
-
_context6.next =
|
|
607
|
+
case 99:
|
|
608
|
+
_context6.next = 104;
|
|
534
609
|
break;
|
|
535
|
-
case
|
|
536
|
-
_context6.prev =
|
|
537
|
-
_context6.
|
|
538
|
-
_iterator.e(_context6.
|
|
539
|
-
case
|
|
540
|
-
_context6.prev =
|
|
610
|
+
case 101:
|
|
611
|
+
_context6.prev = 101;
|
|
612
|
+
_context6.t3 = _context6["catch"](85);
|
|
613
|
+
_iterator.e(_context6.t3);
|
|
614
|
+
case 104:
|
|
615
|
+
_context6.prev = 104;
|
|
541
616
|
_iterator.f();
|
|
542
|
-
return _context6.finish(
|
|
543
|
-
case
|
|
617
|
+
return _context6.finish(104);
|
|
618
|
+
case 107:
|
|
544
619
|
if (!(addedCount > 0)) {
|
|
545
|
-
_context6.next =
|
|
620
|
+
_context6.next = 110;
|
|
546
621
|
break;
|
|
547
622
|
}
|
|
548
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
623
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify13 = bridge.onNotify) === null || _bridge$onNotify13 === void 0 || _bridge$onNotify13.call(bridge, 'success');
|
|
549
624
|
return _context6.abrupt("return", {
|
|
550
625
|
status: 'success',
|
|
551
626
|
kind: 'products',
|
|
@@ -553,36 +628,36 @@ function _applyGlobalScan() {
|
|
|
553
628
|
count: addedCount
|
|
554
629
|
}
|
|
555
630
|
});
|
|
556
|
-
case
|
|
631
|
+
case 110:
|
|
557
632
|
return _context6.abrupt("return", {
|
|
558
633
|
status: 'failed',
|
|
559
634
|
reason: 'no_bridge'
|
|
560
635
|
});
|
|
561
|
-
case
|
|
636
|
+
case 111:
|
|
562
637
|
if (!(searchType === 'order')) {
|
|
563
|
-
_context6.next =
|
|
638
|
+
_context6.next = 120;
|
|
564
639
|
break;
|
|
565
640
|
}
|
|
566
641
|
orderId = (_data$order_id = data === null || data === void 0 ? void 0 : data.order_id) !== null && _data$order_id !== void 0 ? _data$order_id : data === null || data === void 0 ? void 0 : data.id;
|
|
567
642
|
if (orderId) {
|
|
568
|
-
_context6.next =
|
|
643
|
+
_context6.next = 116;
|
|
569
644
|
break;
|
|
570
645
|
}
|
|
571
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
646
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify14 = bridge.onNotify) === null || _bridge$onNotify14 === void 0 || _bridge$onNotify14.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
572
647
|
return _context6.abrupt("return", {
|
|
573
648
|
status: 'failed',
|
|
574
649
|
reason: 'invalid_data'
|
|
575
650
|
});
|
|
576
|
-
case
|
|
651
|
+
case 116:
|
|
577
652
|
if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
|
|
578
|
-
_context6.next =
|
|
653
|
+
_context6.next = 118;
|
|
579
654
|
break;
|
|
580
655
|
}
|
|
581
656
|
return _context6.abrupt("return", {
|
|
582
657
|
status: 'pending',
|
|
583
658
|
kind: 'openOrder'
|
|
584
659
|
});
|
|
585
|
-
case
|
|
660
|
+
case 118:
|
|
586
661
|
bridge.openOrder({
|
|
587
662
|
order_id: Number(orderId),
|
|
588
663
|
business_code: (_data$business_code = data === null || data === void 0 ? void 0 : data.business_code) !== null && _data$business_code !== void 0 ? _data$business_code : host.getBusinessCode()
|
|
@@ -591,16 +666,16 @@ function _applyGlobalScan() {
|
|
|
591
666
|
status: 'pending',
|
|
592
667
|
kind: 'openOrder'
|
|
593
668
|
});
|
|
594
|
-
case
|
|
669
|
+
case 120:
|
|
595
670
|
return _context6.abrupt("return", {
|
|
596
671
|
status: 'failed',
|
|
597
672
|
reason: 'invalid_data'
|
|
598
673
|
});
|
|
599
|
-
case
|
|
674
|
+
case 121:
|
|
600
675
|
case "end":
|
|
601
676
|
return _context6.stop();
|
|
602
677
|
}
|
|
603
|
-
}, _callee6, null, [[
|
|
678
|
+
}, _callee6, null, [[10, 16], [30, 37], [85, 101, 104, 107]]);
|
|
604
679
|
}));
|
|
605
680
|
return _applyGlobalScan.apply(this, arguments);
|
|
606
681
|
}
|
|
@@ -18,7 +18,7 @@ export var searchWalletPass = /*#__PURE__*/function () {
|
|
|
18
18
|
relation_product: 1,
|
|
19
19
|
// 组装关联商品: 0不处理 1处理
|
|
20
20
|
with_franchisor_data: 1,
|
|
21
|
-
with: ['customer'],
|
|
21
|
+
with: ['customer', 'franchiseeWalletPass:shop_id,source_shop_id,product_id,use'],
|
|
22
22
|
tags: ['point_card',
|
|
23
23
|
// 积分卡
|
|
24
24
|
'gift_card',
|
|
@@ -29,6 +29,8 @@ export var searchWalletPass = /*#__PURE__*/function () {
|
|
|
29
29
|
// 折扣卡
|
|
30
30
|
'good_pass',
|
|
31
31
|
// 商品券
|
|
32
|
+
'entitlement_pass',
|
|
33
|
+
// 月卡 / 年卡 / 多次使用卡
|
|
32
34
|
'session_ticket',
|
|
33
35
|
// 场次票
|
|
34
36
|
'appointment_ticket' // 预约类门票
|
|
@@ -10,6 +10,8 @@ export interface GlobalScanFormattedResult {
|
|
|
10
10
|
customerId?: string | number;
|
|
11
11
|
/** 仅 Wallet 返回;true 时禁止直接使用响应内的来源客户。 */
|
|
12
12
|
isCrossShopWallet?: boolean;
|
|
13
|
+
/** 总店 Wallet Pass 未共享给当前子店。 */
|
|
14
|
+
isWalletPassUnavailableAtStore?: boolean;
|
|
13
15
|
}
|
|
14
16
|
interface RawScanSearchResult {
|
|
15
17
|
searchType?: GlobalScanSearchType;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
7
|
/**
|
|
2
8
|
* 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
|
|
3
9
|
*/
|
|
@@ -33,14 +39,17 @@ export function formatGlobalScanResult(raw, scanCode) {
|
|
|
33
39
|
};
|
|
34
40
|
}
|
|
35
41
|
if (searchType === 'walletPass') {
|
|
36
|
-
var _ref2, _ref3, _firstResult$customer, _firstResult$holder, _firstResult$customer2, _firstResult$customer3;
|
|
42
|
+
var _firstResult$franchis, _ref2, _ref3, _firstResult$customer, _firstResult$holder, _firstResult$customer2, _firstResult$customer3;
|
|
37
43
|
var firstResult = resultData === null || resultData === void 0 ? void 0 : resultData[0];
|
|
38
|
-
|
|
44
|
+
var isWalletPassUnavailableAtStore = (firstResult === null || firstResult === void 0 ? void 0 : firstResult.is_franchisor_pass) === 1 && (firstResult === null || firstResult === void 0 || (_firstResult$franchis = firstResult.franchisee_wallet_pass) === null || _firstResult$franchis === void 0 ? void 0 : _firstResult$franchis.use) !== 'enabled';
|
|
45
|
+
return _objectSpread({
|
|
39
46
|
searchType: searchType,
|
|
40
47
|
data: firstResult === null || firstResult === void 0 ? void 0 : firstResult.customer,
|
|
41
48
|
scanCode: scanCode,
|
|
42
49
|
customerId: (_ref2 = (_ref3 = (_firstResult$customer = firstResult === null || firstResult === void 0 ? void 0 : firstResult.customer_id) !== null && _firstResult$customer !== void 0 ? _firstResult$customer : firstResult === null || firstResult === void 0 || (_firstResult$holder = firstResult.holder) === null || _firstResult$holder === void 0 ? void 0 : _firstResult$holder.customer_id) !== null && _ref3 !== void 0 ? _ref3 : firstResult === null || firstResult === void 0 || (_firstResult$customer2 = firstResult.customer) === null || _firstResult$customer2 === void 0 ? void 0 : _firstResult$customer2.id) !== null && _ref2 !== void 0 ? _ref2 : firstResult === null || firstResult === void 0 || (_firstResult$customer3 = firstResult.customer) === null || _firstResult$customer3 === void 0 ? void 0 : _firstResult$customer3.customer_id
|
|
43
|
-
}
|
|
50
|
+
}, isWalletPassUnavailableAtStore ? {
|
|
51
|
+
isWalletPassUnavailableAtStore: true
|
|
52
|
+
} : {});
|
|
44
53
|
}
|
|
45
54
|
if (searchType === 'product' || searchType === 'local_product') {
|
|
46
55
|
return {
|
|
@@ -62,6 +62,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
62
62
|
action?: 'create' | 'edit';
|
|
63
63
|
with_good_pass?: 0 | 1;
|
|
64
64
|
with_discount_card?: 0 | 1;
|
|
65
|
+
with_entitlement_pass?: 0 | 1;
|
|
65
66
|
}): Promise<void>;
|
|
66
67
|
}
|
|
67
68
|
export default ShopDiscountImpl;
|