@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
|
@@ -191,210 +191,300 @@ export function applyGlobalScan(_x14, _x15, _x16) {
|
|
|
191
191
|
return _applyGlobalScan.apply(this, arguments);
|
|
192
192
|
}
|
|
193
193
|
function _applyGlobalScan() {
|
|
194
|
-
_applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
195
|
-
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify,
|
|
196
|
-
return _regeneratorRuntime().wrap(function
|
|
197
|
-
while (1) switch (
|
|
194
|
+
_applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(host, formatted, bridge) {
|
|
195
|
+
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _host$refreshWalletAs, _bridge$onNotify5, snapshot, scannedCustomerIsWalkIn, trySelectWalletAsset, _result$isAccepted, _walletSelection, result, walletSelection, _data$id, _promotionResult$isAc, promotionResult, list, _bridge$onNotify6, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify7, _data$order_id, _data$business_code, orderId, _bridge$onNotify8;
|
|
196
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
197
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
198
198
|
case 0:
|
|
199
199
|
searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode;
|
|
200
200
|
if (!(searchType === 'wallet')) {
|
|
201
|
-
|
|
201
|
+
_context5.next = 8;
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
if (data) {
|
|
205
|
-
|
|
205
|
+
_context5.next = 5;
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
208
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
209
|
-
return
|
|
209
|
+
return _context5.abrupt("return", {
|
|
210
210
|
status: 'failed',
|
|
211
211
|
reason: 'invalid_data'
|
|
212
212
|
});
|
|
213
213
|
case 5:
|
|
214
214
|
host.setOrderCustomer(data);
|
|
215
215
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'success', 'pisell2.text.add-client-success');
|
|
216
|
-
return
|
|
216
|
+
return _context5.abrupt("return", {
|
|
217
217
|
status: 'success',
|
|
218
218
|
kind: 'customer'
|
|
219
219
|
});
|
|
220
220
|
case 8:
|
|
221
221
|
if (!(searchType === 'walletPass')) {
|
|
222
|
-
|
|
222
|
+
_context5.next = 42;
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
225
|
-
if (data) {
|
|
226
|
-
_context4.next = 12;
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
229
|
-
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
230
|
-
return _context4.abrupt("return", {
|
|
231
|
-
status: 'failed',
|
|
232
|
-
reason: 'invalid_data'
|
|
233
|
-
});
|
|
234
|
-
case 12:
|
|
235
225
|
snapshot = host.getOrderCustomerSnapshot();
|
|
236
226
|
scannedCustomerIsWalkIn = isWalkInCustomer(data);
|
|
227
|
+
trySelectWalletAsset = /*#__PURE__*/function () {
|
|
228
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
229
|
+
var _bridge$onNotify4;
|
|
230
|
+
var walletResult, _bridge$onNotify3;
|
|
231
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
232
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
233
|
+
case 0:
|
|
234
|
+
if (host.scanWalletAsset) {
|
|
235
|
+
_context4.next = 2;
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
return _context4.abrupt("return", null);
|
|
239
|
+
case 2:
|
|
240
|
+
_context4.next = 4;
|
|
241
|
+
return host.scanWalletAsset(scanCode).catch(function (error) {
|
|
242
|
+
console.warn('[GlobalScan] Wallet asset lookup failed', error);
|
|
243
|
+
return null;
|
|
244
|
+
});
|
|
245
|
+
case 4:
|
|
246
|
+
walletResult = _context4.sent;
|
|
247
|
+
if (walletResult) {
|
|
248
|
+
_context4.next = 7;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
return _context4.abrupt("return", null);
|
|
252
|
+
case 7:
|
|
253
|
+
if (!(walletResult.type !== 'normalCode' || !walletResult.asset)) {
|
|
254
|
+
_context4.next = 9;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
return _context4.abrupt("return", null);
|
|
258
|
+
case 9:
|
|
259
|
+
if (!walletResult.selected) {
|
|
260
|
+
_context4.next = 12;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'success');
|
|
264
|
+
return _context4.abrupt("return", {
|
|
265
|
+
status: 'success',
|
|
266
|
+
kind: 'promotion'
|
|
267
|
+
});
|
|
268
|
+
case 12:
|
|
269
|
+
// 已识别为 Wallet 支付资产但当前不可用:保留禁用展示,不回退优惠码。
|
|
270
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify4 = bridge.onNotify) === null || _bridge$onNotify4 === void 0 || _bridge$onNotify4.call(bridge, 'fail', 'pisell2.text.goodpass.code-invalid-cart');
|
|
271
|
+
return _context4.abrupt("return", {
|
|
272
|
+
status: 'failed',
|
|
273
|
+
reason: 'invalid_data'
|
|
274
|
+
});
|
|
275
|
+
case 14:
|
|
276
|
+
case "end":
|
|
277
|
+
return _context4.stop();
|
|
278
|
+
}
|
|
279
|
+
}, _callee4);
|
|
280
|
+
}));
|
|
281
|
+
return function trySelectWalletAsset() {
|
|
282
|
+
return _ref2.apply(this, arguments);
|
|
283
|
+
};
|
|
284
|
+
}();
|
|
237
285
|
if (!(isWalkInCustomer(snapshot) || scannedCustomerIsWalkIn)) {
|
|
238
|
-
|
|
286
|
+
_context5.next = 26;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
_context5.next = 15;
|
|
290
|
+
return trySelectWalletAsset();
|
|
291
|
+
case 15:
|
|
292
|
+
_walletSelection = _context5.sent;
|
|
293
|
+
if (!_walletSelection) {
|
|
294
|
+
_context5.next = 18;
|
|
239
295
|
break;
|
|
240
296
|
}
|
|
297
|
+
return _context5.abrupt("return", _walletSelection);
|
|
298
|
+
case 18:
|
|
241
299
|
if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
|
|
242
|
-
|
|
300
|
+
_context5.next = 20;
|
|
243
301
|
break;
|
|
244
302
|
}
|
|
245
|
-
return
|
|
303
|
+
return _context5.abrupt("return", {
|
|
246
304
|
status: 'failed',
|
|
247
305
|
reason: 'no_bridge'
|
|
248
306
|
});
|
|
249
|
-
case
|
|
250
|
-
|
|
307
|
+
case 20:
|
|
308
|
+
_context5.next = 22;
|
|
251
309
|
return bridge.applyPromotionCode(scanCode);
|
|
252
|
-
case
|
|
253
|
-
result =
|
|
254
|
-
if (!(result !== null &&
|
|
255
|
-
|
|
310
|
+
case 22:
|
|
311
|
+
result = _context5.sent;
|
|
312
|
+
if (!((_result$isAccepted = result === null || result === void 0 ? void 0 : result.isAccepted) !== null && _result$isAccepted !== void 0 ? _result$isAccepted : result === null || result === void 0 ? void 0 : result.isAvailable)) {
|
|
313
|
+
_context5.next = 25;
|
|
256
314
|
break;
|
|
257
315
|
}
|
|
258
|
-
return
|
|
316
|
+
return _context5.abrupt("return", {
|
|
259
317
|
status: 'success',
|
|
260
318
|
kind: 'promotion'
|
|
261
319
|
});
|
|
262
|
-
case
|
|
263
|
-
return
|
|
320
|
+
case 25:
|
|
321
|
+
return _context5.abrupt("return", {
|
|
264
322
|
status: 'failed',
|
|
265
323
|
reason: 'invalid_data'
|
|
266
324
|
});
|
|
267
|
-
case
|
|
325
|
+
case 26:
|
|
268
326
|
host.setOrderCustomer(data);
|
|
269
|
-
|
|
270
|
-
return
|
|
327
|
+
_context5.next = 29;
|
|
328
|
+
return (_host$refreshWalletAs = host.refreshWalletAssets) === null || _host$refreshWalletAs === void 0 ? void 0 : _host$refreshWalletAs.call(host, {
|
|
329
|
+
preserveSelection: false
|
|
330
|
+
});
|
|
331
|
+
case 29:
|
|
332
|
+
_context5.next = 31;
|
|
333
|
+
return trySelectWalletAsset();
|
|
334
|
+
case 31:
|
|
335
|
+
walletSelection = _context5.sent;
|
|
336
|
+
if (!walletSelection) {
|
|
337
|
+
_context5.next = 34;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
return _context5.abrupt("return", walletSelection);
|
|
341
|
+
case 34:
|
|
342
|
+
if (!(bridge !== null && bridge !== void 0 && bridge.applyPromotionCode)) {
|
|
343
|
+
_context5.next = 40;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
_context5.next = 37;
|
|
347
|
+
return bridge.applyPromotionCode(scanCode, Number((_data$id = data === null || data === void 0 ? void 0 : data.id) !== null && _data$id !== void 0 ? _data$id : data === null || data === void 0 ? void 0 : data.customer_id) || undefined);
|
|
348
|
+
case 37:
|
|
349
|
+
promotionResult = _context5.sent;
|
|
350
|
+
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)) {
|
|
351
|
+
_context5.next = 40;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
return _context5.abrupt("return", {
|
|
355
|
+
status: 'success',
|
|
356
|
+
kind: 'promotion'
|
|
357
|
+
});
|
|
358
|
+
case 40:
|
|
359
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'success', 'pisell2.text.add-client-success');
|
|
360
|
+
return _context5.abrupt("return", {
|
|
271
361
|
status: 'success',
|
|
272
362
|
kind: 'customer'
|
|
273
363
|
});
|
|
274
|
-
case
|
|
364
|
+
case 42:
|
|
275
365
|
if (!(searchType === 'product' || searchType === 'local_product')) {
|
|
276
|
-
|
|
366
|
+
_context5.next = 75;
|
|
277
367
|
break;
|
|
278
368
|
}
|
|
279
369
|
list = data === null || data === void 0 ? void 0 : data.list;
|
|
280
370
|
if (!(!Array.isArray(list) || list.length === 0)) {
|
|
281
|
-
|
|
371
|
+
_context5.next = 47;
|
|
282
372
|
break;
|
|
283
373
|
}
|
|
284
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
285
|
-
return
|
|
374
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
375
|
+
return _context5.abrupt("return", {
|
|
286
376
|
status: 'failed',
|
|
287
377
|
reason: 'invalid_data'
|
|
288
378
|
});
|
|
289
|
-
case
|
|
379
|
+
case 47:
|
|
290
380
|
addedCount = 0;
|
|
291
381
|
_iterator = _createForOfIteratorHelper(list);
|
|
292
|
-
|
|
382
|
+
_context5.prev = 49;
|
|
293
383
|
_iterator.s();
|
|
294
|
-
case
|
|
384
|
+
case 51:
|
|
295
385
|
if ((_step = _iterator.n()).done) {
|
|
296
|
-
|
|
386
|
+
_context5.next = 63;
|
|
297
387
|
break;
|
|
298
388
|
}
|
|
299
389
|
_item = _step.value;
|
|
300
|
-
|
|
390
|
+
_context5.next = 55;
|
|
301
391
|
return processScannedProductItem(host, _item, scanCode, bridge);
|
|
302
|
-
case
|
|
303
|
-
outcome =
|
|
392
|
+
case 55:
|
|
393
|
+
outcome = _context5.sent;
|
|
304
394
|
if (outcome === 'added') {
|
|
305
395
|
addedCount += 1;
|
|
306
396
|
}
|
|
307
397
|
if (!(outcome === 'cancelled')) {
|
|
308
|
-
|
|
398
|
+
_context5.next = 59;
|
|
309
399
|
break;
|
|
310
400
|
}
|
|
311
|
-
return
|
|
401
|
+
return _context5.abrupt("return", {
|
|
312
402
|
status: 'cancelled'
|
|
313
403
|
});
|
|
314
|
-
case
|
|
404
|
+
case 59:
|
|
315
405
|
if (!(outcome === 'pending')) {
|
|
316
|
-
|
|
406
|
+
_context5.next = 61;
|
|
317
407
|
break;
|
|
318
408
|
}
|
|
319
|
-
return
|
|
409
|
+
return _context5.abrupt("return", {
|
|
320
410
|
status: 'pending',
|
|
321
411
|
kind: 'requiresDetail'
|
|
322
412
|
});
|
|
323
|
-
case
|
|
324
|
-
|
|
413
|
+
case 61:
|
|
414
|
+
_context5.next = 51;
|
|
325
415
|
break;
|
|
326
|
-
case
|
|
327
|
-
|
|
416
|
+
case 63:
|
|
417
|
+
_context5.next = 68;
|
|
328
418
|
break;
|
|
329
|
-
case
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
_iterator.e(
|
|
333
|
-
case
|
|
334
|
-
|
|
419
|
+
case 65:
|
|
420
|
+
_context5.prev = 65;
|
|
421
|
+
_context5.t0 = _context5["catch"](49);
|
|
422
|
+
_iterator.e(_context5.t0);
|
|
423
|
+
case 68:
|
|
424
|
+
_context5.prev = 68;
|
|
335
425
|
_iterator.f();
|
|
336
|
-
return
|
|
337
|
-
case
|
|
426
|
+
return _context5.finish(68);
|
|
427
|
+
case 71:
|
|
338
428
|
if (!(addedCount > 0)) {
|
|
339
|
-
|
|
429
|
+
_context5.next = 74;
|
|
340
430
|
break;
|
|
341
431
|
}
|
|
342
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
343
|
-
return
|
|
432
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'success');
|
|
433
|
+
return _context5.abrupt("return", {
|
|
344
434
|
status: 'success',
|
|
345
435
|
kind: 'products',
|
|
346
436
|
meta: {
|
|
347
437
|
count: addedCount
|
|
348
438
|
}
|
|
349
439
|
});
|
|
350
|
-
case
|
|
351
|
-
return
|
|
440
|
+
case 74:
|
|
441
|
+
return _context5.abrupt("return", {
|
|
352
442
|
status: 'failed',
|
|
353
443
|
reason: 'no_bridge'
|
|
354
444
|
});
|
|
355
|
-
case
|
|
445
|
+
case 75:
|
|
356
446
|
if (!(searchType === 'order')) {
|
|
357
|
-
|
|
447
|
+
_context5.next = 84;
|
|
358
448
|
break;
|
|
359
449
|
}
|
|
360
450
|
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;
|
|
361
451
|
if (orderId) {
|
|
362
|
-
|
|
452
|
+
_context5.next = 80;
|
|
363
453
|
break;
|
|
364
454
|
}
|
|
365
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
366
|
-
return
|
|
455
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify8 = bridge.onNotify) === null || _bridge$onNotify8 === void 0 || _bridge$onNotify8.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
456
|
+
return _context5.abrupt("return", {
|
|
367
457
|
status: 'failed',
|
|
368
458
|
reason: 'invalid_data'
|
|
369
459
|
});
|
|
370
|
-
case
|
|
460
|
+
case 80:
|
|
371
461
|
if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
|
|
372
|
-
|
|
462
|
+
_context5.next = 82;
|
|
373
463
|
break;
|
|
374
464
|
}
|
|
375
|
-
return
|
|
465
|
+
return _context5.abrupt("return", {
|
|
376
466
|
status: 'pending',
|
|
377
467
|
kind: 'openOrder'
|
|
378
468
|
});
|
|
379
|
-
case
|
|
469
|
+
case 82:
|
|
380
470
|
bridge.openOrder({
|
|
381
471
|
order_id: Number(orderId),
|
|
382
472
|
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()
|
|
383
473
|
});
|
|
384
|
-
return
|
|
474
|
+
return _context5.abrupt("return", {
|
|
385
475
|
status: 'pending',
|
|
386
476
|
kind: 'openOrder'
|
|
387
477
|
});
|
|
388
|
-
case
|
|
389
|
-
return
|
|
478
|
+
case 84:
|
|
479
|
+
return _context5.abrupt("return", {
|
|
390
480
|
status: 'failed',
|
|
391
481
|
reason: 'invalid_data'
|
|
392
482
|
});
|
|
393
|
-
case
|
|
483
|
+
case 85:
|
|
394
484
|
case "end":
|
|
395
|
-
return
|
|
485
|
+
return _context5.stop();
|
|
396
486
|
}
|
|
397
|
-
},
|
|
487
|
+
}, _callee5, null, [[49, 65, 68, 71]]);
|
|
398
488
|
}));
|
|
399
489
|
return _applyGlobalScan.apply(this, arguments);
|
|
400
490
|
}
|
|
@@ -83,6 +83,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
83
83
|
private getBookingAppointmentStatus;
|
|
84
84
|
private isBookingIncludedInStats;
|
|
85
85
|
private getBookingOrderPaymentStatus;
|
|
86
|
+
private isUnpaidBooking;
|
|
86
87
|
private countBookingOrders;
|
|
87
88
|
private countCompletedBookings;
|
|
88
89
|
private groupBookingsByResource;
|
|
@@ -94,6 +95,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
94
95
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
95
96
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
96
97
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
98
|
+
* - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
|
|
97
99
|
*/
|
|
98
100
|
private pickBookingsForCurrentPoint;
|
|
99
101
|
/**
|
|
@@ -29,6 +29,7 @@ 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']);
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* Sales 解决方案基础骨架
|
|
@@ -415,6 +416,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
415
416
|
var _booking$order$paymen, _booking$order;
|
|
416
417
|
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 : '');
|
|
417
418
|
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "isUnpaidBooking",
|
|
421
|
+
value: function isUnpaidBooking(booking) {
|
|
422
|
+
return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
|
|
423
|
+
}
|
|
418
424
|
}, {
|
|
419
425
|
key: "countBookingOrders",
|
|
420
426
|
value: function countBookingOrders(bookings) {
|
|
@@ -479,11 +485,13 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
479
485
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
480
486
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
481
487
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
488
|
+
* - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
|
|
482
489
|
*/
|
|
483
490
|
}, {
|
|
484
491
|
key: "pickBookingsForCurrentPoint",
|
|
485
492
|
value: function pickBookingsForCurrentPoint(current, bookings) {
|
|
486
493
|
var _this4 = this;
|
|
494
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
487
495
|
if (bookings.length === 0) return [];
|
|
488
496
|
var currentDayStart = current.startOf('day');
|
|
489
497
|
var currentDayEnd = current.endOf('day');
|
|
@@ -498,6 +506,13 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
498
506
|
if (dayScopedBookings.length === 0) return [];
|
|
499
507
|
var appendNextStartGroupIfNeeded = function appendNextStartGroupIfNeeded(selectedBookings) {
|
|
500
508
|
if (selectedBookings.length === 0) return selectedBookings;
|
|
509
|
+
if (options.includeAllFuture) {
|
|
510
|
+
var allFutureBookings = dayScopedBookings.filter(function (booking) {
|
|
511
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
512
|
+
return startAt.isValid() && startAt.isAfter(current);
|
|
513
|
+
});
|
|
514
|
+
return [].concat(_toConsumableArray(selectedBookings), _toConsumableArray(allFutureBookings));
|
|
515
|
+
}
|
|
501
516
|
var shouldAppendNextGroup = selectedBookings.some(function (booking) {
|
|
502
517
|
return booking.status === 'reserved' || booking.status === 'occupied';
|
|
503
518
|
});
|
|
@@ -548,6 +563,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
548
563
|
return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current, 'day');
|
|
549
564
|
});
|
|
550
565
|
if (upcoming.length > 0) {
|
|
566
|
+
if (options.includeAllFuture) return upcoming;
|
|
551
567
|
var firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
|
|
552
568
|
var upcomingStartGroup = upcoming.filter(function (booking) {
|
|
553
569
|
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
@@ -895,11 +911,15 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
895
911
|
});
|
|
896
912
|
completedBookingList = matchedBookingList.filter(function (booking) {
|
|
897
913
|
return _this7.getBookingAppointmentStatus(booking) === 'completed';
|
|
898
|
-
});
|
|
914
|
+
}); // const unpaidBookingList = matchedBookingList.filter(
|
|
915
|
+
// (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
|
|
916
|
+
// );
|
|
899
917
|
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
900
|
-
return _this7.
|
|
918
|
+
return _this7.isUnpaidBooking(booking);
|
|
919
|
+
});
|
|
920
|
+
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList), {
|
|
921
|
+
includeAllFuture: true
|
|
901
922
|
});
|
|
902
|
-
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
|
|
903
923
|
completedBookings = completedBookingList.map(function (booking) {
|
|
904
924
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
905
925
|
status: 'compelete',
|
|
@@ -911,7 +931,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
911
931
|
remainingReserveTime: undefined
|
|
912
932
|
});
|
|
913
933
|
});
|
|
914
|
-
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList)
|
|
934
|
+
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList), {
|
|
935
|
+
includeAllFuture: true
|
|
936
|
+
});
|
|
915
937
|
orderCount = this.countBookingOrders(statsBookingList);
|
|
916
938
|
bookingCount = statsBookingList.length;
|
|
917
939
|
compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
@@ -41,6 +41,10 @@ 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
|
+
}
|
|
44
48
|
export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
45
49
|
_inherits(ScanOrderImpl, _BaseModule);
|
|
46
50
|
var _super = _createSuper(ScanOrderImpl);
|
|
@@ -1177,7 +1181,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1177
1181
|
_iterator3.s();
|
|
1178
1182
|
case 19:
|
|
1179
1183
|
if ((_step3 = _iterator3.n()).done) {
|
|
1180
|
-
_context15.next =
|
|
1184
|
+
_context15.next = 36;
|
|
1181
1185
|
break;
|
|
1182
1186
|
}
|
|
1183
1187
|
product = _step3.value;
|
|
@@ -1185,8 +1189,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1185
1189
|
_context15.next = 23;
|
|
1186
1190
|
break;
|
|
1187
1191
|
}
|
|
1188
|
-
return _context15.abrupt("continue",
|
|
1192
|
+
return _context15.abrupt("continue", 34);
|
|
1189
1193
|
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:
|
|
1190
1201
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1191
1202
|
var _pd$discount$resource, _pd$discount;
|
|
1192
1203
|
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;
|
|
@@ -1210,47 +1221,47 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1210
1221
|
mainPrice: newMainSellingPrice,
|
|
1211
1222
|
bundle: product.product_bundle
|
|
1212
1223
|
});
|
|
1213
|
-
case
|
|
1224
|
+
case 34:
|
|
1214
1225
|
_context15.next = 19;
|
|
1215
1226
|
break;
|
|
1216
|
-
case
|
|
1217
|
-
_context15.next =
|
|
1227
|
+
case 36:
|
|
1228
|
+
_context15.next = 41;
|
|
1218
1229
|
break;
|
|
1219
|
-
case 35:
|
|
1220
|
-
_context15.prev = 35;
|
|
1221
|
-
_context15.t0 = _context15["catch"](17);
|
|
1222
|
-
_iterator3.e(_context15.t0);
|
|
1223
1230
|
case 38:
|
|
1224
1231
|
_context15.prev = 38;
|
|
1225
|
-
|
|
1226
|
-
|
|
1232
|
+
_context15.t0 = _context15["catch"](17);
|
|
1233
|
+
_iterator3.e(_context15.t0);
|
|
1227
1234
|
case 41:
|
|
1235
|
+
_context15.prev = 41;
|
|
1236
|
+
_iterator3.f();
|
|
1237
|
+
return _context15.finish(41);
|
|
1238
|
+
case 44:
|
|
1228
1239
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1229
|
-
_context15.next =
|
|
1240
|
+
_context15.next = 47;
|
|
1230
1241
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1231
|
-
case
|
|
1242
|
+
case 47:
|
|
1232
1243
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1233
1244
|
return d.isSelected;
|
|
1234
1245
|
});
|
|
1235
|
-
_context15.next =
|
|
1246
|
+
_context15.next = 50;
|
|
1236
1247
|
return this.store.order.recalculateSummary({
|
|
1237
1248
|
createIfMissing: true
|
|
1238
1249
|
});
|
|
1239
|
-
case
|
|
1250
|
+
case 50:
|
|
1240
1251
|
this.store.order.persistTempOrder();
|
|
1241
1252
|
this.logMethodSuccess('setDiscountSelected', params);
|
|
1242
|
-
_context15.next =
|
|
1253
|
+
_context15.next = 58;
|
|
1243
1254
|
break;
|
|
1244
|
-
case
|
|
1245
|
-
_context15.prev =
|
|
1255
|
+
case 54:
|
|
1256
|
+
_context15.prev = 54;
|
|
1246
1257
|
_context15.t1 = _context15["catch"](1);
|
|
1247
1258
|
this.logMethodError('setDiscountSelected', _context15.t1);
|
|
1248
1259
|
throw _context15.t1;
|
|
1249
|
-
case
|
|
1260
|
+
case 58:
|
|
1250
1261
|
case "end":
|
|
1251
1262
|
return _context15.stop();
|
|
1252
1263
|
}
|
|
1253
|
-
}, _callee15, this, [[1,
|
|
1264
|
+
}, _callee15, this, [[1, 54], [17, 38, 41, 44]]);
|
|
1254
1265
|
}));
|
|
1255
1266
|
function setDiscountSelected(_x8) {
|
|
1256
1267
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -152,6 +152,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
152
152
|
private recalculateOrderPricesFromQuotation;
|
|
153
153
|
scanCode(code: string, customerId?: number): Promise<{
|
|
154
154
|
isAvailable: boolean;
|
|
155
|
+
isAccepted?: boolean | undefined;
|
|
155
156
|
discountList: import("../../modules/Discount").Discount[];
|
|
156
157
|
type: "server" | "clientCalc";
|
|
157
158
|
unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;
|