@pisell/pisellos 2.2.273 → 2.2.275
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Order/index.d.ts +7 -6
- package/dist/modules/Order/index.js +217 -115
- package/dist/modules/Order/types.d.ts +23 -3
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Payment/index.js +1 -1
- package/dist/modules/Payment/types.d.ts +81 -4
- package/dist/modules/Payment/types.js +18 -3
- package/dist/modules/Payment/walletpass.d.ts +38 -1
- package/dist/modules/Payment/walletpass.js +917 -114
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +78 -64
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +27 -18
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +16 -0
- package/dist/server/modules/order/index.js +964 -776
- package/dist/server/modules/order/types.d.ts +14 -0
- package/dist/server/modules/order/types.js +6 -0
- package/dist/solution/BaseSales/index.d.ts +80 -15
- package/dist/solution/BaseSales/index.js +1498 -444
- package/dist/solution/BaseSales/types.d.ts +55 -1
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +8 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +12 -3
- 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 +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Order/index.d.ts +7 -6
- package/lib/modules/Order/index.js +127 -20
- package/lib/modules/Order/types.d.ts +23 -3
- package/lib/modules/Payment/index.js +1 -1
- package/lib/modules/Payment/types.d.ts +81 -4
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +38 -1
- package/lib/modules/Payment/walletpass.js +730 -21
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +24 -14
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +4 -0
- package/lib/server/index.js +14 -6
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +16 -0
- package/lib/server/modules/order/index.js +140 -4
- package/lib/server/modules/order/types.d.ts +14 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +80 -15
- package/lib/solution/BaseSales/index.js +712 -48
- package/lib/solution/BaseSales/types.d.ts +55 -1
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +8 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +4 -1
- 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 +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/VenueBooking/index.d.ts +1 -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
|
}
|
|
@@ -95,6 +95,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
95
95
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
96
96
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
97
97
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
98
|
+
* - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
|
|
98
99
|
*/
|
|
99
100
|
private pickBookingsForCurrentPoint;
|
|
100
101
|
/**
|
|
@@ -485,11 +485,13 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
485
485
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
486
486
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
487
487
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
488
|
+
* - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
|
|
488
489
|
*/
|
|
489
490
|
}, {
|
|
490
491
|
key: "pickBookingsForCurrentPoint",
|
|
491
492
|
value: function pickBookingsForCurrentPoint(current, bookings) {
|
|
492
493
|
var _this4 = this;
|
|
494
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
493
495
|
if (bookings.length === 0) return [];
|
|
494
496
|
var currentDayStart = current.startOf('day');
|
|
495
497
|
var currentDayEnd = current.endOf('day');
|
|
@@ -504,6 +506,13 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
504
506
|
if (dayScopedBookings.length === 0) return [];
|
|
505
507
|
var appendNextStartGroupIfNeeded = function appendNextStartGroupIfNeeded(selectedBookings) {
|
|
506
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
|
+
}
|
|
507
516
|
var shouldAppendNextGroup = selectedBookings.some(function (booking) {
|
|
508
517
|
return booking.status === 'reserved' || booking.status === 'occupied';
|
|
509
518
|
});
|
|
@@ -554,6 +563,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
554
563
|
return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current, 'day');
|
|
555
564
|
});
|
|
556
565
|
if (upcoming.length > 0) {
|
|
566
|
+
if (options.includeAllFuture) return upcoming;
|
|
557
567
|
var firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
|
|
558
568
|
var upcomingStartGroup = upcoming.filter(function (booking) {
|
|
559
569
|
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
@@ -907,7 +917,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
907
917
|
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
908
918
|
return _this7.isUnpaidBooking(booking);
|
|
909
919
|
});
|
|
910
|
-
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
|
|
920
|
+
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList), {
|
|
921
|
+
includeAllFuture: true
|
|
922
|
+
});
|
|
911
923
|
completedBookings = completedBookingList.map(function (booking) {
|
|
912
924
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
913
925
|
status: 'compelete',
|
|
@@ -919,7 +931,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
919
931
|
remainingReserveTime: undefined
|
|
920
932
|
});
|
|
921
933
|
});
|
|
922
|
-
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList)
|
|
934
|
+
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList), {
|
|
935
|
+
includeAllFuture: true
|
|
936
|
+
});
|
|
923
937
|
orderCount = this.countBookingOrders(statsBookingList);
|
|
924
938
|
bookingCount = statsBookingList.length;
|
|
925
939
|
compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
@@ -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;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
-
default: () => import_adapter2.default
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
-
var import_evaluator = require("./evaluator");
|
|
41
|
-
var import_adapter = require("./adapter");
|
|
42
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
-
var import_examples = require("./examples");
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
-
ITEM_REWARD_STRATEGY,
|
|
48
|
-
PromotionAdapter,
|
|
49
|
-
PromotionEvaluator,
|
|
50
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
-
});
|
|
@@ -149,7 +149,9 @@ function mapOrderBundleToOtherBundle(bundle) {
|
|
|
149
149
|
return bundle.map((item) => {
|
|
150
150
|
return {
|
|
151
151
|
...item,
|
|
152
|
-
|
|
152
|
+
// 后端历史订单可能没有 original_price;此时 price 是折前毛价,
|
|
153
|
+
// bundle_selling_price 已包含折扣,不能把它当成编辑时的新原价。
|
|
154
|
+
original_price: item.original_price ?? item.product_price ?? item.price ?? item.bundle_selling_price
|
|
153
155
|
};
|
|
154
156
|
});
|
|
155
157
|
}
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -81,6 +81,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
81
81
|
private ensureEditDiscountConfigForProductChange;
|
|
82
82
|
scanCode(code: string, customerId?: number): Promise<{
|
|
83
83
|
isAvailable: boolean;
|
|
84
|
+
isAccepted?: boolean;
|
|
84
85
|
discountList: Discount[];
|
|
85
86
|
type: 'server' | 'clientCalc';
|
|
86
87
|
unavailableReason?: UnavailableReason;
|
|
@@ -383,7 +384,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
383
384
|
* await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
|
|
384
385
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
385
386
|
*/
|
|
386
|
-
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
|
|
387
|
+
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<OrderProduct[]>;
|
|
387
388
|
/**
|
|
388
389
|
* 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
|
|
389
390
|
*
|
|
@@ -421,8 +422,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
421
422
|
* @example
|
|
422
423
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
423
424
|
*/
|
|
424
|
-
removeProductsFromOrder(identities: OrderProductIdentity[]): Promise<OrderProduct[]>;
|
|
425
|
-
removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
|
|
425
|
+
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
426
|
+
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
426
427
|
/**
|
|
427
428
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
428
429
|
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
@@ -485,7 +486,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
485
486
|
generateIdempotencyToken(): string;
|
|
486
487
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
487
488
|
createOrder(params: CommitOrderParams['query']): {
|
|
488
|
-
type: "
|
|
489
|
+
type: "appointment_booking" | "virtual";
|
|
489
490
|
platform: string;
|
|
490
491
|
sales_channel: string;
|
|
491
492
|
order_sales_channel: string;
|
|
@@ -560,4 +561,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
560
561
|
getOrderInfo(order_id: number): Promise<any>;
|
|
561
562
|
getVouchers(): any[];
|
|
562
563
|
}
|
|
563
|
-
export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
564
|
+
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|