@pisell/pisellos 0.0.96 → 0.0.97
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/Account/index.d.ts +1 -0
- package/dist/modules/Account/index.js +6 -0
- package/dist/modules/Account/types.d.ts +2 -0
- package/dist/modules/AccountList/index.d.ts +1 -0
- package/dist/modules/AccountList/index.js +7 -0
- package/dist/modules/Product/index.d.ts +1 -0
- package/dist/modules/Product/index.js +6 -0
- package/dist/modules/ProductList/index.js +21 -9
- package/dist/plugins/user.d.ts +7 -0
- package/dist/plugins/user.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -0
- package/dist/solution/BookingByStep/index.js +378 -240
- package/lib/modules/Account/index.d.ts +1 -0
- package/lib/modules/Account/index.js +4 -0
- package/lib/modules/Account/types.d.ts +2 -0
- package/lib/modules/AccountList/index.d.ts +1 -0
- package/lib/modules/AccountList/index.js +3 -0
- package/lib/modules/Product/index.d.ts +1 -0
- package/lib/modules/Product/index.js +3 -0
- package/lib/modules/ProductList/index.js +16 -2
- package/lib/plugins/user.d.ts +7 -0
- package/lib/plugins/user.js +17 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -0
- package/lib/solution/BookingByStep/index.js +68 -0
- package/package.json +1 -1
|
@@ -203,8 +203,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
203
203
|
key: "loadProducts",
|
|
204
204
|
value: function () {
|
|
205
205
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
206
|
-
var _schedule_ids;
|
|
207
|
-
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$schedule_ids, schedule_ids, schedule_date, schedule_ids_data, productsData;
|
|
206
|
+
var _schedule_ids, _userPlugin$get;
|
|
207
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$schedule_ids, schedule_ids, schedule_date, schedule_ids_data, userPlugin, customer_id, productsData;
|
|
208
208
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
209
209
|
while (1) switch (_context2.prev = _context2.next) {
|
|
210
210
|
case 0:
|
|
@@ -221,7 +221,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
221
221
|
schedule_ids = [0];
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
|
|
224
|
+
userPlugin = this.core.getPlugin('user');
|
|
225
|
+
customer_id = userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id; // 如果没传schedule_date,则从
|
|
226
|
+
_context2.next = 6;
|
|
225
227
|
return this.request.post("/product/query", {
|
|
226
228
|
open_quotation: 1,
|
|
227
229
|
open_bundle: 1,
|
|
@@ -230,6 +232,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
230
232
|
status: 'published',
|
|
231
233
|
num: 500,
|
|
232
234
|
skip: 1,
|
|
235
|
+
customer_id: customer_id,
|
|
233
236
|
category_ids: category_ids,
|
|
234
237
|
ids: product_ids,
|
|
235
238
|
collection: collection,
|
|
@@ -239,11 +242,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
239
242
|
}, {
|
|
240
243
|
useCache: true
|
|
241
244
|
});
|
|
242
|
-
case
|
|
245
|
+
case 6:
|
|
243
246
|
productsData = _context2.sent;
|
|
244
247
|
this.store.products.addProduct(productsData.data.list);
|
|
245
248
|
return _context2.abrupt("return", productsData.data.list);
|
|
246
|
-
case
|
|
249
|
+
case 9:
|
|
247
250
|
case "end":
|
|
248
251
|
return _context2.stop();
|
|
249
252
|
}
|
|
@@ -299,30 +302,142 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
299
302
|
return _loadProductByScheduleDate.apply(this, arguments);
|
|
300
303
|
}
|
|
301
304
|
return loadProductByScheduleDate;
|
|
305
|
+
}()
|
|
306
|
+
}, {
|
|
307
|
+
key: "updateQuotationPriceAndCart",
|
|
308
|
+
value: function () {
|
|
309
|
+
var _updateQuotationPriceAndCart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(date) {
|
|
310
|
+
var _this$otherParams3,
|
|
311
|
+
_this3 = this;
|
|
312
|
+
var dateRange, scheduleIds, scheduleList, cartItems, _iterator, _step, _loop;
|
|
313
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
314
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
315
|
+
case 0:
|
|
316
|
+
dateRange = this.store.date.getDateRange();
|
|
317
|
+
scheduleIds = [];
|
|
318
|
+
if (dateRange.length) {
|
|
319
|
+
scheduleList = this.store.schedule.getAvailabilityScheduleDateList();
|
|
320
|
+
scheduleIds = scheduleList.filter(function (n) {
|
|
321
|
+
return n.date === dateRange[0].date;
|
|
322
|
+
}).flatMap(function (n) {
|
|
323
|
+
return n.schedule_id;
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
_context5.next = 5;
|
|
327
|
+
return this.loadProducts(_objectSpread(_objectSpread({}, (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.productModuleParams), {}, {
|
|
328
|
+
scheduleIds: scheduleIds,
|
|
329
|
+
schedule_date: date
|
|
330
|
+
}));
|
|
331
|
+
case 5:
|
|
332
|
+
// 更新完商品数据以后,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
|
|
333
|
+
cartItems = this.store.cart.getItems();
|
|
334
|
+
if (!cartItems.length) {
|
|
335
|
+
_context5.next = 24;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
_iterator = _createForOfIteratorHelper(cartItems);
|
|
339
|
+
_context5.prev = 8;
|
|
340
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
341
|
+
var _bundle;
|
|
342
|
+
var item, targetProduct, productInfo, bundle;
|
|
343
|
+
return _regeneratorRuntime().wrap(function _loop$(_context4) {
|
|
344
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
345
|
+
case 0:
|
|
346
|
+
item = _step.value;
|
|
347
|
+
_context4.next = 3;
|
|
348
|
+
return _this3.store.products.getProduct(item.id);
|
|
349
|
+
case 3:
|
|
350
|
+
targetProduct = _context4.sent;
|
|
351
|
+
productInfo = cloneDeep(targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.getData());
|
|
352
|
+
bundle = item._bundleOrigin;
|
|
353
|
+
bundle = (_bundle = bundle) === null || _bundle === void 0 ? void 0 : _bundle.map(function (n) {
|
|
354
|
+
var _productInfo$bundle;
|
|
355
|
+
// 尝试到新的 productInfo 里找对应的 bundleitem
|
|
356
|
+
// 然后更新 bundle 的价格
|
|
357
|
+
var targetBundle = productInfo === null || productInfo === void 0 || (_productInfo$bundle = productInfo.bundle) === null || _productInfo$bundle === void 0 ? void 0 : _productInfo$bundle.find(function (m) {
|
|
358
|
+
return m.group_id === n.id;
|
|
359
|
+
});
|
|
360
|
+
if (targetBundle) {
|
|
361
|
+
var targetBundleItem = targetBundle.items.find(function (m) {
|
|
362
|
+
return m.id === n.id;
|
|
363
|
+
});
|
|
364
|
+
if (targetBundleItem) {
|
|
365
|
+
return _objectSpread(_objectSpread({}, n), {}, {
|
|
366
|
+
price: targetBundleItem.price,
|
|
367
|
+
base_price: targetBundleItem.base_price
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return n;
|
|
372
|
+
});
|
|
373
|
+
_this3.store.cart.updateItem({
|
|
374
|
+
_id: item._id,
|
|
375
|
+
product: productInfo,
|
|
376
|
+
bundle: bundle
|
|
377
|
+
});
|
|
378
|
+
case 8:
|
|
379
|
+
case "end":
|
|
380
|
+
return _context4.stop();
|
|
381
|
+
}
|
|
382
|
+
}, _loop);
|
|
383
|
+
});
|
|
384
|
+
_iterator.s();
|
|
385
|
+
case 11:
|
|
386
|
+
if ((_step = _iterator.n()).done) {
|
|
387
|
+
_context5.next = 15;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
return _context5.delegateYield(_loop(), "t0", 13);
|
|
391
|
+
case 13:
|
|
392
|
+
_context5.next = 11;
|
|
393
|
+
break;
|
|
394
|
+
case 15:
|
|
395
|
+
_context5.next = 20;
|
|
396
|
+
break;
|
|
397
|
+
case 17:
|
|
398
|
+
_context5.prev = 17;
|
|
399
|
+
_context5.t1 = _context5["catch"](8);
|
|
400
|
+
_iterator.e(_context5.t1);
|
|
401
|
+
case 20:
|
|
402
|
+
_context5.prev = 20;
|
|
403
|
+
_iterator.f();
|
|
404
|
+
return _context5.finish(20);
|
|
405
|
+
case 23:
|
|
406
|
+
;
|
|
407
|
+
case 24:
|
|
408
|
+
case "end":
|
|
409
|
+
return _context5.stop();
|
|
410
|
+
}
|
|
411
|
+
}, _callee4, this, [[8, 17, 20, 23]]);
|
|
412
|
+
}));
|
|
413
|
+
function updateQuotationPriceAndCart(_x5) {
|
|
414
|
+
return _updateQuotationPriceAndCart.apply(this, arguments);
|
|
415
|
+
}
|
|
416
|
+
return updateQuotationPriceAndCart;
|
|
302
417
|
}() // 加载当前店铺下所有 schedule
|
|
303
418
|
}, {
|
|
304
419
|
key: "loadAllSchedule",
|
|
305
420
|
value: function () {
|
|
306
|
-
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
421
|
+
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
307
422
|
var _scheduleList$data;
|
|
308
423
|
var scheduleList;
|
|
309
|
-
return _regeneratorRuntime().wrap(function
|
|
310
|
-
while (1) switch (
|
|
424
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
425
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
311
426
|
case 0:
|
|
312
|
-
|
|
427
|
+
_context6.next = 2;
|
|
313
428
|
return this.request.get("/schedule", {
|
|
314
429
|
num: 999
|
|
315
430
|
}, {
|
|
316
431
|
useCache: true
|
|
317
432
|
});
|
|
318
433
|
case 2:
|
|
319
|
-
scheduleList =
|
|
434
|
+
scheduleList = _context6.sent;
|
|
320
435
|
this.store.schedule.setScheduleList(((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []);
|
|
321
436
|
case 4:
|
|
322
437
|
case "end":
|
|
323
|
-
return
|
|
438
|
+
return _context6.stop();
|
|
324
439
|
}
|
|
325
|
-
},
|
|
440
|
+
}, _callee5, this);
|
|
326
441
|
}));
|
|
327
442
|
function loadAllSchedule() {
|
|
328
443
|
return _loadAllSchedule.apply(this, arguments);
|
|
@@ -332,11 +447,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
332
447
|
}, {
|
|
333
448
|
key: "loadScheduleAvailableDate",
|
|
334
449
|
value: function () {
|
|
335
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
450
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref3) {
|
|
336
451
|
var _res$data$date_list;
|
|
337
452
|
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
338
|
-
return _regeneratorRuntime().wrap(function
|
|
339
|
-
while (1) switch (
|
|
453
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
454
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
340
455
|
case 0:
|
|
341
456
|
startDate = _ref3.startDate, endDate = _ref3.endDate, custom_page_id = _ref3.custom_page_id, channel = _ref3.channel;
|
|
342
457
|
// 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天,需要把 startDate 置为今天
|
|
@@ -348,12 +463,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
348
463
|
dates = disableAllDates(dates);
|
|
349
464
|
// 如果 endDate 在今天之前,则不用查接口,直接返回 dates
|
|
350
465
|
if (!dayjs(endDate).isBefore(dayjs(), 'day')) {
|
|
351
|
-
|
|
466
|
+
_context7.next = 6;
|
|
352
467
|
break;
|
|
353
468
|
}
|
|
354
|
-
return
|
|
469
|
+
return _context7.abrupt("return", dates);
|
|
355
470
|
case 6:
|
|
356
|
-
|
|
471
|
+
_context7.next = 8;
|
|
357
472
|
return this.request.get("/schedule/product/availability", {
|
|
358
473
|
start_date: startDate,
|
|
359
474
|
end_date: endDate,
|
|
@@ -361,14 +476,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
361
476
|
channel: channel
|
|
362
477
|
});
|
|
363
478
|
case 8:
|
|
364
|
-
res =
|
|
479
|
+
res = _context7.sent;
|
|
365
480
|
this.store.schedule.setAvailabilityScheduleDateList(res.data.date_list);
|
|
366
481
|
// 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
|
|
367
482
|
if (!(!((_res$data$date_list = res.data.date_list) !== null && _res$data$date_list !== void 0 && _res$data$date_list.length) || dayjs(endDate).isBefore(dayjs(), 'day'))) {
|
|
368
|
-
|
|
483
|
+
_context7.next = 12;
|
|
369
484
|
break;
|
|
370
485
|
}
|
|
371
|
-
return
|
|
486
|
+
return _context7.abrupt("return", dates);
|
|
372
487
|
case 12:
|
|
373
488
|
res.data.date_list.forEach(function (n) {
|
|
374
489
|
var index = dates.findIndex(function (m) {
|
|
@@ -379,14 +494,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
379
494
|
}
|
|
380
495
|
});
|
|
381
496
|
dates = disableDatesBeforeOneDay(dates);
|
|
382
|
-
return
|
|
497
|
+
return _context7.abrupt("return", dates);
|
|
383
498
|
case 15:
|
|
384
499
|
case "end":
|
|
385
|
-
return
|
|
500
|
+
return _context7.stop();
|
|
386
501
|
}
|
|
387
|
-
},
|
|
502
|
+
}, _callee6, this);
|
|
388
503
|
}));
|
|
389
|
-
function loadScheduleAvailableDate(
|
|
504
|
+
function loadScheduleAvailableDate(_x6) {
|
|
390
505
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
391
506
|
}
|
|
392
507
|
return loadScheduleAvailableDate;
|
|
@@ -394,10 +509,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
394
509
|
}, {
|
|
395
510
|
key: "storeProduct",
|
|
396
511
|
value: function () {
|
|
397
|
-
var _storeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
512
|
+
var _storeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(productData) {
|
|
398
513
|
var activeAccount, _ref4, bundle, options, origin, product_variant_id, product, addCartItem;
|
|
399
|
-
return _regeneratorRuntime().wrap(function
|
|
400
|
-
while (1) switch (
|
|
514
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
515
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
401
516
|
case 0:
|
|
402
517
|
// 往购物车加商品数据的时候,默认用当前 activeAccount 填充到 product 的 account 里面
|
|
403
518
|
activeAccount = this.getActiveAccount();
|
|
@@ -416,11 +531,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
416
531
|
this.store.cart.addItem(addCartItem);
|
|
417
532
|
case 6:
|
|
418
533
|
case "end":
|
|
419
|
-
return
|
|
534
|
+
return _context8.stop();
|
|
420
535
|
}
|
|
421
|
-
},
|
|
536
|
+
}, _callee7, this);
|
|
422
537
|
}));
|
|
423
|
-
function storeProduct(
|
|
538
|
+
function storeProduct(_x7) {
|
|
424
539
|
return _storeProduct.apply(this, arguments);
|
|
425
540
|
}
|
|
426
541
|
return storeProduct;
|
|
@@ -428,37 +543,37 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
428
543
|
}, {
|
|
429
544
|
key: "addAccount",
|
|
430
545
|
value: function () {
|
|
431
|
-
var _addAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
546
|
+
var _addAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(account, extra) {
|
|
432
547
|
var accountModules, newAccount;
|
|
433
|
-
return _regeneratorRuntime().wrap(function
|
|
434
|
-
while (1) switch (
|
|
548
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
549
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
435
550
|
case 0:
|
|
436
551
|
if (!((extra === null || extra === void 0 ? void 0 : extra.type) === 'holder')) {
|
|
437
|
-
|
|
552
|
+
_context9.next = 5;
|
|
438
553
|
break;
|
|
439
554
|
}
|
|
440
|
-
|
|
555
|
+
_context9.next = 3;
|
|
441
556
|
return this.store.accountList.addHolderAccounts({
|
|
442
557
|
holders: [account],
|
|
443
558
|
customerId: extra.customerId,
|
|
444
559
|
type: 'unshift'
|
|
445
560
|
});
|
|
446
561
|
case 3:
|
|
447
|
-
accountModules =
|
|
448
|
-
return
|
|
562
|
+
accountModules = _context9.sent;
|
|
563
|
+
return _context9.abrupt("return", accountModules[0].getAccount());
|
|
449
564
|
case 5:
|
|
450
|
-
|
|
565
|
+
_context9.next = 7;
|
|
451
566
|
return this.store.accountList.addAccount(account);
|
|
452
567
|
case 7:
|
|
453
|
-
newAccount =
|
|
454
|
-
return
|
|
568
|
+
newAccount = _context9.sent;
|
|
569
|
+
return _context9.abrupt("return", newAccount.getAccount());
|
|
455
570
|
case 9:
|
|
456
571
|
case "end":
|
|
457
|
-
return
|
|
572
|
+
return _context9.stop();
|
|
458
573
|
}
|
|
459
|
-
},
|
|
574
|
+
}, _callee8, this);
|
|
460
575
|
}));
|
|
461
|
-
function addAccount(
|
|
576
|
+
function addAccount(_x8, _x9) {
|
|
462
577
|
return _addAccount.apply(this, arguments);
|
|
463
578
|
}
|
|
464
579
|
return addAccount;
|
|
@@ -466,13 +581,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
466
581
|
}, {
|
|
467
582
|
key: "addAccounts",
|
|
468
583
|
value: function () {
|
|
469
|
-
var _addAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
470
|
-
var res,
|
|
471
|
-
return _regeneratorRuntime().wrap(function
|
|
472
|
-
while (1) switch (
|
|
584
|
+
var _addAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(accounts, extra) {
|
|
585
|
+
var res, _iterator2, _step2, account, accountModule, accountData;
|
|
586
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
587
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
473
588
|
case 0:
|
|
474
589
|
if (!((extra === null || extra === void 0 ? void 0 : extra.type) === 'holder')) {
|
|
475
|
-
|
|
590
|
+
_context10.next = 3;
|
|
476
591
|
break;
|
|
477
592
|
}
|
|
478
593
|
this.store.accountList.addHolderAccounts({
|
|
@@ -480,49 +595,49 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
480
595
|
customerId: extra.customerId,
|
|
481
596
|
type: 'unshift'
|
|
482
597
|
});
|
|
483
|
-
return
|
|
598
|
+
return _context10.abrupt("return");
|
|
484
599
|
case 3:
|
|
485
600
|
res = [];
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
601
|
+
_iterator2 = _createForOfIteratorHelper(accounts);
|
|
602
|
+
_context10.prev = 5;
|
|
603
|
+
_iterator2.s();
|
|
489
604
|
case 7:
|
|
490
|
-
if ((
|
|
491
|
-
|
|
605
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
606
|
+
_context10.next = 16;
|
|
492
607
|
break;
|
|
493
608
|
}
|
|
494
|
-
account =
|
|
495
|
-
|
|
609
|
+
account = _step2.value;
|
|
610
|
+
_context10.next = 11;
|
|
496
611
|
return this.store.accountList.addAccount(account);
|
|
497
612
|
case 11:
|
|
498
|
-
accountModule =
|
|
613
|
+
accountModule = _context10.sent;
|
|
499
614
|
accountData = accountModule.getAccount();
|
|
500
615
|
if (accountData) {
|
|
501
616
|
res.push(accountData);
|
|
502
617
|
}
|
|
503
618
|
case 14:
|
|
504
|
-
|
|
619
|
+
_context10.next = 7;
|
|
505
620
|
break;
|
|
506
621
|
case 16:
|
|
507
|
-
|
|
622
|
+
_context10.next = 21;
|
|
508
623
|
break;
|
|
509
624
|
case 18:
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
625
|
+
_context10.prev = 18;
|
|
626
|
+
_context10.t0 = _context10["catch"](5);
|
|
627
|
+
_iterator2.e(_context10.t0);
|
|
513
628
|
case 21:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
return
|
|
629
|
+
_context10.prev = 21;
|
|
630
|
+
_iterator2.f();
|
|
631
|
+
return _context10.finish(21);
|
|
517
632
|
case 24:
|
|
518
|
-
return
|
|
633
|
+
return _context10.abrupt("return", res);
|
|
519
634
|
case 25:
|
|
520
635
|
case "end":
|
|
521
|
-
return
|
|
636
|
+
return _context10.stop();
|
|
522
637
|
}
|
|
523
|
-
},
|
|
638
|
+
}, _callee9, this, [[5, 18, 21, 24]]);
|
|
524
639
|
}));
|
|
525
|
-
function addAccounts(
|
|
640
|
+
function addAccounts(_x10, _x11) {
|
|
526
641
|
return _addAccounts.apply(this, arguments);
|
|
527
642
|
}
|
|
528
643
|
return addAccounts;
|
|
@@ -530,20 +645,20 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
530
645
|
}, {
|
|
531
646
|
key: "getAccounts",
|
|
532
647
|
value: function () {
|
|
533
|
-
var _getAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
648
|
+
var _getAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
534
649
|
var accounts;
|
|
535
|
-
return _regeneratorRuntime().wrap(function
|
|
536
|
-
while (1) switch (
|
|
650
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
651
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
537
652
|
case 0:
|
|
538
653
|
accounts = this.store.accountList.getAccounts();
|
|
539
|
-
return
|
|
654
|
+
return _context11.abrupt("return", accounts.map(function (account) {
|
|
540
655
|
return account.getAccount();
|
|
541
656
|
}));
|
|
542
657
|
case 2:
|
|
543
658
|
case "end":
|
|
544
|
-
return
|
|
659
|
+
return _context11.stop();
|
|
545
660
|
}
|
|
546
|
-
},
|
|
661
|
+
}, _callee10, this);
|
|
547
662
|
}));
|
|
548
663
|
function getAccounts() {
|
|
549
664
|
return _getAccounts.apply(this, arguments);
|
|
@@ -584,18 +699,28 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
584
699
|
}, {
|
|
585
700
|
key: "fetchHolderAccountsAsync",
|
|
586
701
|
value: (function () {
|
|
587
|
-
var _fetchHolderAccountsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
588
|
-
|
|
589
|
-
|
|
702
|
+
var _fetchHolderAccountsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
703
|
+
var cartItems, _this$store$date$getD, date, _cartItems$;
|
|
704
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context12) {
|
|
705
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
590
706
|
case 0:
|
|
591
|
-
|
|
592
|
-
|
|
707
|
+
cartItems = this.store.cart.getItems();
|
|
708
|
+
if (cartItems.length) {
|
|
709
|
+
date = (_this$store$date$getD = this.store.date.getDateRange()) === null || _this$store$date$getD === void 0 || (_this$store$date$getD = _this$store$date$getD[0]) === null || _this$store$date$getD === void 0 ? void 0 : _this$store$date$getD.date;
|
|
710
|
+
if (!date) {
|
|
711
|
+
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
712
|
+
date = (cartItems === null || cartItems === void 0 || (_cartItems$ = cartItems[0]) === null || _cartItems$ === void 0 ? void 0 : _cartItems$.start_date) || '';
|
|
713
|
+
}
|
|
714
|
+
this.updateQuotationPriceAndCart(date);
|
|
715
|
+
}
|
|
716
|
+
return _context12.abrupt("return", this.store.accountList.fetchHolderAccounts(params));
|
|
717
|
+
case 3:
|
|
593
718
|
case "end":
|
|
594
|
-
return
|
|
719
|
+
return _context12.stop();
|
|
595
720
|
}
|
|
596
|
-
},
|
|
721
|
+
}, _callee11, this);
|
|
597
722
|
}));
|
|
598
|
-
function fetchHolderAccountsAsync(
|
|
723
|
+
function fetchHolderAccountsAsync(_x12) {
|
|
599
724
|
return _fetchHolderAccountsAsync.apply(this, arguments);
|
|
600
725
|
}
|
|
601
726
|
return fetchHolderAccountsAsync;
|
|
@@ -604,18 +729,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
604
729
|
}, {
|
|
605
730
|
key: "setDateRange",
|
|
606
731
|
value: function () {
|
|
607
|
-
var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
608
|
-
return _regeneratorRuntime().wrap(function
|
|
609
|
-
while (1) switch (
|
|
732
|
+
var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(dateRange) {
|
|
733
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context13) {
|
|
734
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
610
735
|
case 0:
|
|
611
736
|
this.store.date.setDateRange(dateRange);
|
|
612
|
-
|
|
737
|
+
// 日期数据变更后,如果购物车里有数据,需要更新购物车里的报价单的价格
|
|
738
|
+
if (dateRange.length && this.store.cart.getItems().length) {
|
|
739
|
+
this.updateQuotationPriceAndCart(dateRange[0].date);
|
|
740
|
+
}
|
|
741
|
+
case 2:
|
|
613
742
|
case "end":
|
|
614
|
-
return
|
|
743
|
+
return _context13.stop();
|
|
615
744
|
}
|
|
616
|
-
},
|
|
745
|
+
}, _callee12, this);
|
|
617
746
|
}));
|
|
618
|
-
function setDateRange(
|
|
747
|
+
function setDateRange(_x13) {
|
|
619
748
|
return _setDateRange.apply(this, arguments);
|
|
620
749
|
}
|
|
621
750
|
return setDateRange;
|
|
@@ -630,16 +759,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
630
759
|
}, {
|
|
631
760
|
key: "getDateRange",
|
|
632
761
|
value: function () {
|
|
633
|
-
var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
634
|
-
return _regeneratorRuntime().wrap(function
|
|
635
|
-
while (1) switch (
|
|
762
|
+
var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
763
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context14) {
|
|
764
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
636
765
|
case 0:
|
|
637
|
-
return
|
|
766
|
+
return _context14.abrupt("return", this.store.date.getDateRange());
|
|
638
767
|
case 1:
|
|
639
768
|
case "end":
|
|
640
|
-
return
|
|
769
|
+
return _context14.stop();
|
|
641
770
|
}
|
|
642
|
-
},
|
|
771
|
+
}, _callee13, this);
|
|
643
772
|
}));
|
|
644
773
|
function getDateRange() {
|
|
645
774
|
return _getDateRange.apply(this, arguments);
|
|
@@ -656,8 +785,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
656
785
|
}, {
|
|
657
786
|
key: "getAvailableDate",
|
|
658
787
|
value: function () {
|
|
659
|
-
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
660
|
-
var
|
|
788
|
+
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
789
|
+
var _this4 = this,
|
|
661
790
|
_dateRange$,
|
|
662
791
|
_dateRange$2,
|
|
663
792
|
_dateRange$3;
|
|
@@ -675,11 +804,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
675
804
|
rules,
|
|
676
805
|
resourcesMap,
|
|
677
806
|
res,
|
|
678
|
-
|
|
679
|
-
return _regeneratorRuntime().wrap(function
|
|
680
|
-
while (1) switch (
|
|
807
|
+
_args15 = arguments;
|
|
808
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context15) {
|
|
809
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
681
810
|
case 0:
|
|
682
|
-
params =
|
|
811
|
+
params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
683
812
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
684
813
|
products = params.products, startDate = params.startDate, endDate = params.endDate, type = params.type; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
685
814
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -691,7 +820,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
691
820
|
if (tempProducts.length) {
|
|
692
821
|
tempProducts.forEach(function (p) {
|
|
693
822
|
if (p !== null && p !== void 0 && p['schedule.ids']) {
|
|
694
|
-
var scheduleData =
|
|
823
|
+
var scheduleData = _this4.getScheduleDataByIds(p['schedule.ids']);
|
|
695
824
|
p['_schedule'] = scheduleData;
|
|
696
825
|
}
|
|
697
826
|
});
|
|
@@ -706,15 +835,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
706
835
|
tempStartDate = startDate || (dateRange === null || dateRange === void 0 || (_dateRange$ = dateRange[0]) === null || _dateRange$ === void 0 ? void 0 : _dateRange$.date);
|
|
707
836
|
tempEndDate = endDate || (dateRange === null || dateRange === void 0 || (_dateRange$2 = dateRange[1]) === null || _dateRange$2 === void 0 ? void 0 : _dateRange$2.date) || (dateRange === null || dateRange === void 0 || (_dateRange$3 = dateRange[0]) === null || _dateRange$3 === void 0 ? void 0 : _dateRange$3.date);
|
|
708
837
|
if (tempProducts.length) {
|
|
709
|
-
|
|
838
|
+
_context15.next = 11;
|
|
710
839
|
break;
|
|
711
840
|
}
|
|
712
|
-
return
|
|
841
|
+
return _context15.abrupt("return", []);
|
|
713
842
|
case 11:
|
|
714
843
|
// 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
|
|
715
844
|
_ref5 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref5.resourceIds, rules = _ref5.rules, resourcesMap = _ref5.resourcesMap;
|
|
716
845
|
this.otherParams.currentResourcesMap = resourcesMap;
|
|
717
|
-
|
|
846
|
+
_context15.next = 15;
|
|
718
847
|
return this.store.date.getResourceDates({
|
|
719
848
|
url: params.url,
|
|
720
849
|
query: {
|
|
@@ -726,13 +855,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
726
855
|
type: type
|
|
727
856
|
});
|
|
728
857
|
case 15:
|
|
729
|
-
res =
|
|
730
|
-
return
|
|
858
|
+
res = _context15.sent;
|
|
859
|
+
return _context15.abrupt("return", res);
|
|
731
860
|
case 17:
|
|
732
861
|
case "end":
|
|
733
|
-
return
|
|
862
|
+
return _context15.stop();
|
|
734
863
|
}
|
|
735
|
-
},
|
|
864
|
+
}, _callee14, this);
|
|
736
865
|
}));
|
|
737
866
|
function getAvailableDate() {
|
|
738
867
|
return _getAvailableDate.apply(this, arguments);
|
|
@@ -745,22 +874,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
745
874
|
}, {
|
|
746
875
|
key: "getSummary",
|
|
747
876
|
value: (function () {
|
|
748
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
877
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
749
878
|
var cartItems, summary;
|
|
750
|
-
return _regeneratorRuntime().wrap(function
|
|
751
|
-
while (1) switch (
|
|
879
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context16) {
|
|
880
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
752
881
|
case 0:
|
|
753
882
|
cartItems = this.store.cart.getItems();
|
|
754
|
-
|
|
883
|
+
_context16.next = 3;
|
|
755
884
|
return this.store.summary.getSummary(cartItems);
|
|
756
885
|
case 3:
|
|
757
|
-
summary =
|
|
758
|
-
return
|
|
886
|
+
summary = _context16.sent;
|
|
887
|
+
return _context16.abrupt("return", summary);
|
|
759
888
|
case 5:
|
|
760
889
|
case "end":
|
|
761
|
-
return
|
|
890
|
+
return _context16.stop();
|
|
762
891
|
}
|
|
763
|
-
},
|
|
892
|
+
}, _callee15, this);
|
|
764
893
|
}));
|
|
765
894
|
function getSummary() {
|
|
766
895
|
return _getSummary.apply(this, arguments);
|
|
@@ -774,18 +903,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
774
903
|
}, {
|
|
775
904
|
key: "getProtocol",
|
|
776
905
|
value: (function () {
|
|
777
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
778
|
-
return _regeneratorRuntime().wrap(function
|
|
779
|
-
while (1) switch (
|
|
906
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(protocolId) {
|
|
907
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context17) {
|
|
908
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
780
909
|
case 0:
|
|
781
|
-
return
|
|
910
|
+
return _context17.abrupt("return", this.store.summary.getProtocol(protocolId));
|
|
782
911
|
case 1:
|
|
783
912
|
case "end":
|
|
784
|
-
return
|
|
913
|
+
return _context17.stop();
|
|
785
914
|
}
|
|
786
|
-
},
|
|
915
|
+
}, _callee16, this);
|
|
787
916
|
}));
|
|
788
|
-
function getProtocol(
|
|
917
|
+
function getProtocol(_x14) {
|
|
789
918
|
return _getProtocol.apply(this, arguments);
|
|
790
919
|
}
|
|
791
920
|
return getProtocol;
|
|
@@ -794,16 +923,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
794
923
|
}, {
|
|
795
924
|
key: "getProducts",
|
|
796
925
|
value: function () {
|
|
797
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
798
|
-
return _regeneratorRuntime().wrap(function
|
|
799
|
-
while (1) switch (
|
|
926
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
927
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context18) {
|
|
928
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
800
929
|
case 0:
|
|
801
|
-
return
|
|
930
|
+
return _context18.abrupt("return", this.store.products.getProducts());
|
|
802
931
|
case 1:
|
|
803
932
|
case "end":
|
|
804
|
-
return
|
|
933
|
+
return _context18.stop();
|
|
805
934
|
}
|
|
806
|
-
},
|
|
935
|
+
}, _callee17, this);
|
|
807
936
|
}));
|
|
808
937
|
function getProducts() {
|
|
809
938
|
return _getProducts.apply(this, arguments);
|
|
@@ -813,41 +942,50 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
813
942
|
}, {
|
|
814
943
|
key: "setLoginAccount",
|
|
815
944
|
value: function () {
|
|
816
|
-
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
817
|
-
var
|
|
818
|
-
var account, stateAccountId, cartItems;
|
|
819
|
-
return _regeneratorRuntime().wrap(function
|
|
820
|
-
while (1) switch (
|
|
945
|
+
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(accountId, accountInfo) {
|
|
946
|
+
var _this5 = this;
|
|
947
|
+
var account, stateAccountId, cartItems, _this$store$date$getD2, date, _cartItems$2;
|
|
948
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context19) {
|
|
949
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
821
950
|
case 0:
|
|
822
951
|
account = this.store.accountList.getAccount(accountId);
|
|
823
952
|
if (!account) {
|
|
824
|
-
|
|
953
|
+
_context19.next = 11;
|
|
825
954
|
break;
|
|
826
955
|
}
|
|
827
956
|
stateAccountId = account.getId();
|
|
957
|
+
accountInfo.isLogin = true;
|
|
828
958
|
account.setAccountInfo(accountInfo);
|
|
829
959
|
// 然后去购物车,把原先关联了 holder_id 为 accountId 的商品,替换为 holder_id = accountInfo.id
|
|
830
960
|
cartItems = this.store.cart.getItems();
|
|
831
961
|
cartItems.forEach(function (item) {
|
|
832
962
|
if (item.holder_id === accountId) {
|
|
833
|
-
|
|
963
|
+
_this5.store.cart.updateItem({
|
|
834
964
|
_id: item._id,
|
|
835
965
|
account: accountInfo
|
|
836
966
|
});
|
|
837
967
|
}
|
|
838
968
|
});
|
|
839
969
|
this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
|
|
840
|
-
|
|
970
|
+
if (cartItems.length) {
|
|
971
|
+
date = (_this$store$date$getD2 = this.store.date.getDateRange()) === null || _this$store$date$getD2 === void 0 || (_this$store$date$getD2 = _this$store$date$getD2[0]) === null || _this$store$date$getD2 === void 0 ? void 0 : _this$store$date$getD2.date;
|
|
972
|
+
if (!date) {
|
|
973
|
+
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
974
|
+
date = (cartItems === null || cartItems === void 0 || (_cartItems$2 = cartItems[0]) === null || _cartItems$2 === void 0 ? void 0 : _cartItems$2.start_date) || '';
|
|
975
|
+
}
|
|
976
|
+
this.updateQuotationPriceAndCart(date);
|
|
977
|
+
}
|
|
978
|
+
_context19.next = 12;
|
|
841
979
|
break;
|
|
842
|
-
case
|
|
980
|
+
case 11:
|
|
843
981
|
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
844
|
-
case
|
|
982
|
+
case 12:
|
|
845
983
|
case "end":
|
|
846
|
-
return
|
|
984
|
+
return _context19.stop();
|
|
847
985
|
}
|
|
848
|
-
},
|
|
986
|
+
}, _callee18, this);
|
|
849
987
|
}));
|
|
850
|
-
function setLoginAccount(
|
|
988
|
+
function setLoginAccount(_x15, _x16) {
|
|
851
989
|
return _setLoginAccount.apply(this, arguments);
|
|
852
990
|
}
|
|
853
991
|
return setLoginAccount;
|
|
@@ -855,14 +993,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
855
993
|
}, {
|
|
856
994
|
key: "generateCartData",
|
|
857
995
|
value: function () {
|
|
858
|
-
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
859
|
-
return _regeneratorRuntime().wrap(function
|
|
860
|
-
while (1) switch (
|
|
996
|
+
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
997
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context20) {
|
|
998
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
861
999
|
case 0:
|
|
862
1000
|
case "end":
|
|
863
|
-
return
|
|
1001
|
+
return _context20.stop();
|
|
864
1002
|
}
|
|
865
|
-
},
|
|
1003
|
+
}, _callee19);
|
|
866
1004
|
}));
|
|
867
1005
|
function generateCartData() {
|
|
868
1006
|
return _generateCartData.apply(this, arguments);
|
|
@@ -872,23 +1010,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
872
1010
|
}, {
|
|
873
1011
|
key: "getFreeProduct",
|
|
874
1012
|
value: function () {
|
|
875
|
-
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1013
|
+
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(id) {
|
|
876
1014
|
var res;
|
|
877
|
-
return _regeneratorRuntime().wrap(function
|
|
878
|
-
while (1) switch (
|
|
1015
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context21) {
|
|
1016
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
879
1017
|
case 0:
|
|
880
|
-
|
|
1018
|
+
_context21.next = 2;
|
|
881
1019
|
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
882
1020
|
case 2:
|
|
883
|
-
res =
|
|
884
|
-
return
|
|
1021
|
+
res = _context21.sent;
|
|
1022
|
+
return _context21.abrupt("return", res);
|
|
885
1023
|
case 4:
|
|
886
1024
|
case "end":
|
|
887
|
-
return
|
|
1025
|
+
return _context21.stop();
|
|
888
1026
|
}
|
|
889
|
-
},
|
|
1027
|
+
}, _callee20, this);
|
|
890
1028
|
}));
|
|
891
|
-
function getFreeProduct(
|
|
1029
|
+
function getFreeProduct(_x17) {
|
|
892
1030
|
return _getFreeProduct.apply(this, arguments);
|
|
893
1031
|
}
|
|
894
1032
|
return getFreeProduct;
|
|
@@ -911,10 +1049,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
911
1049
|
}, {
|
|
912
1050
|
key: "submitOrder",
|
|
913
1051
|
value: function () {
|
|
914
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1052
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
915
1053
|
var cartItems, newCartItems;
|
|
916
|
-
return _regeneratorRuntime().wrap(function
|
|
917
|
-
while (1) switch (
|
|
1054
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context22) {
|
|
1055
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
918
1056
|
case 0:
|
|
919
1057
|
cartItems = this.store.cart.getItems();
|
|
920
1058
|
newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
@@ -940,16 +1078,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
940
1078
|
item._origin.metadata.capacity = formatCapacity;
|
|
941
1079
|
item._origin.number = currentCapacity;
|
|
942
1080
|
});
|
|
943
|
-
return
|
|
1081
|
+
return _context22.abrupt("return", this.store.order.submitOrder({
|
|
944
1082
|
query: {
|
|
945
1083
|
cartItems: newCartItems
|
|
946
1084
|
}
|
|
947
1085
|
}));
|
|
948
1086
|
case 4:
|
|
949
1087
|
case "end":
|
|
950
|
-
return
|
|
1088
|
+
return _context22.stop();
|
|
951
1089
|
}
|
|
952
|
-
},
|
|
1090
|
+
}, _callee21, this);
|
|
953
1091
|
}));
|
|
954
1092
|
function submitOrder() {
|
|
955
1093
|
return _submitOrder.apply(this, arguments);
|
|
@@ -959,14 +1097,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
959
1097
|
}, {
|
|
960
1098
|
key: "pay",
|
|
961
1099
|
value: function () {
|
|
962
|
-
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
963
|
-
return _regeneratorRuntime().wrap(function
|
|
964
|
-
while (1) switch (
|
|
1100
|
+
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1101
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context23) {
|
|
1102
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
965
1103
|
case 0:
|
|
966
1104
|
case "end":
|
|
967
|
-
return
|
|
1105
|
+
return _context23.stop();
|
|
968
1106
|
}
|
|
969
|
-
},
|
|
1107
|
+
}, _callee22);
|
|
970
1108
|
}));
|
|
971
1109
|
function pay() {
|
|
972
1110
|
return _pay.apply(this, arguments);
|
|
@@ -976,14 +1114,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
976
1114
|
}, {
|
|
977
1115
|
key: "getPayInfo",
|
|
978
1116
|
value: function () {
|
|
979
|
-
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
980
|
-
return _regeneratorRuntime().wrap(function
|
|
981
|
-
while (1) switch (
|
|
1117
|
+
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1118
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context24) {
|
|
1119
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
982
1120
|
case 0:
|
|
983
1121
|
case "end":
|
|
984
|
-
return
|
|
1122
|
+
return _context24.stop();
|
|
985
1123
|
}
|
|
986
|
-
},
|
|
1124
|
+
}, _callee23);
|
|
987
1125
|
}));
|
|
988
1126
|
function getPayInfo() {
|
|
989
1127
|
return _getPayInfo.apply(this, arguments);
|
|
@@ -993,15 +1131,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
993
1131
|
}, {
|
|
994
1132
|
key: "setOtherParams",
|
|
995
1133
|
value: function () {
|
|
996
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1134
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
997
1135
|
var _ref6,
|
|
998
1136
|
_ref6$cover,
|
|
999
1137
|
cover,
|
|
1000
|
-
|
|
1001
|
-
return _regeneratorRuntime().wrap(function
|
|
1002
|
-
while (1) switch (
|
|
1138
|
+
_args25 = arguments;
|
|
1139
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context25) {
|
|
1140
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1003
1141
|
case 0:
|
|
1004
|
-
_ref6 =
|
|
1142
|
+
_ref6 = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {}, _ref6$cover = _ref6.cover, cover = _ref6$cover === void 0 ? false : _ref6$cover;
|
|
1005
1143
|
if (cover) {
|
|
1006
1144
|
this.otherParams = params;
|
|
1007
1145
|
} else {
|
|
@@ -1009,11 +1147,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1009
1147
|
}
|
|
1010
1148
|
case 2:
|
|
1011
1149
|
case "end":
|
|
1012
|
-
return
|
|
1150
|
+
return _context25.stop();
|
|
1013
1151
|
}
|
|
1014
|
-
},
|
|
1152
|
+
}, _callee24, this);
|
|
1015
1153
|
}));
|
|
1016
|
-
function setOtherParams(
|
|
1154
|
+
function setOtherParams(_x18) {
|
|
1017
1155
|
return _setOtherParams.apply(this, arguments);
|
|
1018
1156
|
}
|
|
1019
1157
|
return setOtherParams;
|
|
@@ -1021,16 +1159,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1021
1159
|
}, {
|
|
1022
1160
|
key: "getOtherParams",
|
|
1023
1161
|
value: function () {
|
|
1024
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1025
|
-
return _regeneratorRuntime().wrap(function
|
|
1026
|
-
while (1) switch (
|
|
1162
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1163
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
1164
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1027
1165
|
case 0:
|
|
1028
|
-
return
|
|
1166
|
+
return _context26.abrupt("return", this.otherParams);
|
|
1029
1167
|
case 1:
|
|
1030
1168
|
case "end":
|
|
1031
|
-
return
|
|
1169
|
+
return _context26.stop();
|
|
1032
1170
|
}
|
|
1033
|
-
},
|
|
1171
|
+
}, _callee25, this);
|
|
1034
1172
|
}));
|
|
1035
1173
|
function getOtherParams() {
|
|
1036
1174
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1040,7 +1178,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1040
1178
|
}, {
|
|
1041
1179
|
key: "updateCart",
|
|
1042
1180
|
value: function updateCart(params) {
|
|
1043
|
-
var
|
|
1181
|
+
var _this6 = this;
|
|
1044
1182
|
var targetCartItem = this.store.cart.getItem(params._id);
|
|
1045
1183
|
if (!targetCartItem) {
|
|
1046
1184
|
throw new Error("\u6CA1\u6709\u627E\u5230".concat(params._id, "\u8D2D\u7269\u8F66\u5546\u54C1"));
|
|
@@ -1129,7 +1267,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1129
1267
|
var end_time = item.end_time;
|
|
1130
1268
|
var start_date = item.start_date;
|
|
1131
1269
|
var end_date = item.end_date;
|
|
1132
|
-
|
|
1270
|
+
_this6.store.cart.updateItem({
|
|
1133
1271
|
_id: item._id,
|
|
1134
1272
|
resources: resources,
|
|
1135
1273
|
date: {
|
|
@@ -1138,7 +1276,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1138
1276
|
}
|
|
1139
1277
|
});
|
|
1140
1278
|
} else {
|
|
1141
|
-
|
|
1279
|
+
_this6.store.cart.updateItem({
|
|
1142
1280
|
_id: item._id,
|
|
1143
1281
|
resources: resources
|
|
1144
1282
|
});
|
|
@@ -1175,10 +1313,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1175
1313
|
}, {
|
|
1176
1314
|
key: "batchUpdateCart",
|
|
1177
1315
|
value: function batchUpdateCart(paramsList) {
|
|
1178
|
-
var
|
|
1316
|
+
var _this7 = this;
|
|
1179
1317
|
var cartItems = [];
|
|
1180
1318
|
paramsList.forEach(function (params) {
|
|
1181
|
-
var cartItem =
|
|
1319
|
+
var cartItem = _this7.store.cart.formatCartItem(params);
|
|
1182
1320
|
cartItems.push(cartItem);
|
|
1183
1321
|
});
|
|
1184
1322
|
this.store.cart.batchSetItems(cartItems);
|
|
@@ -1206,11 +1344,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1206
1344
|
}, {
|
|
1207
1345
|
key: "checkCartItems",
|
|
1208
1346
|
value: function checkCartItems(type) {
|
|
1209
|
-
var
|
|
1347
|
+
var _this8 = this;
|
|
1210
1348
|
var cartItems = this.store.cart.getItems();
|
|
1211
1349
|
var errorCartItemIds = [];
|
|
1212
1350
|
cartItems.forEach(function (cartItem) {
|
|
1213
|
-
var result =
|
|
1351
|
+
var result = _this8.store.cart.checkCartItemByType(cartItem, type);
|
|
1214
1352
|
if (!result) {
|
|
1215
1353
|
errorCartItemIds.push(cartItem._id);
|
|
1216
1354
|
}
|
|
@@ -1638,11 +1776,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1638
1776
|
// .format("HH:mm");
|
|
1639
1777
|
// 根据 start_time 和 end_time 去匹配资源
|
|
1640
1778
|
var targetResource = null;
|
|
1641
|
-
var
|
|
1642
|
-
|
|
1779
|
+
var _iterator3 = _createForOfIteratorHelper(resources),
|
|
1780
|
+
_step3;
|
|
1643
1781
|
try {
|
|
1644
|
-
var
|
|
1645
|
-
var n =
|
|
1782
|
+
var _loop2 = function _loop2() {
|
|
1783
|
+
var n = _step3.value;
|
|
1646
1784
|
// 如果资源是独占的,并且 countMap 里选择过这个资源,则直接跳过
|
|
1647
1785
|
// if (n.resourceType === 'single' && countMap[n.id]) {
|
|
1648
1786
|
// resourcesUseableMap[n.id] = false;
|
|
@@ -1681,15 +1819,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1681
1819
|
}
|
|
1682
1820
|
},
|
|
1683
1821
|
_ret;
|
|
1684
|
-
for (
|
|
1685
|
-
_ret =
|
|
1822
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1823
|
+
_ret = _loop2();
|
|
1686
1824
|
if (_ret === 0) continue;
|
|
1687
1825
|
if (_ret === 1) break;
|
|
1688
1826
|
}
|
|
1689
1827
|
} catch (err) {
|
|
1690
|
-
|
|
1828
|
+
_iterator3.e(err);
|
|
1691
1829
|
} finally {
|
|
1692
|
-
|
|
1830
|
+
_iterator3.f();
|
|
1693
1831
|
}
|
|
1694
1832
|
return {
|
|
1695
1833
|
selectedResource: targetResource
|
|
@@ -1724,7 +1862,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1724
1862
|
key: "autoSelectAllProductResources",
|
|
1725
1863
|
value: function autoSelectAllProductResources(resources_code, timeSlots) {
|
|
1726
1864
|
var _dateRange$4,
|
|
1727
|
-
|
|
1865
|
+
_this9 = this;
|
|
1728
1866
|
var dateRange = this.store.date.getDateRange();
|
|
1729
1867
|
var resources = [];
|
|
1730
1868
|
if (dateRange !== null && dateRange !== void 0 && (_dateRange$4 = dateRange[0]) !== null && _dateRange$4 !== void 0 && _dateRange$4.date) {
|
|
@@ -1781,7 +1919,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1781
1919
|
};
|
|
1782
1920
|
}
|
|
1783
1921
|
// 如果传递了 timeSlots,代表是第二种资源,则直接拿 timeSlots 去匹配
|
|
1784
|
-
var res =
|
|
1922
|
+
var res = _this9.autoSelectAccountResources({
|
|
1785
1923
|
cartItem: item,
|
|
1786
1924
|
holder_id: item.holder_id,
|
|
1787
1925
|
resources_code: resources_code,
|
|
@@ -1801,7 +1939,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1801
1939
|
}
|
|
1802
1940
|
res.selectedResource.capacity = currentCapacity;
|
|
1803
1941
|
checkSubResourcesCapacity(res.selectedResource);
|
|
1804
|
-
|
|
1942
|
+
_this9.store.cart.updateItem({
|
|
1805
1943
|
_id: item._id,
|
|
1806
1944
|
// 这里要做去重,避免出现同样类型的资源被塞进同一个商品
|
|
1807
1945
|
resources: [].concat(_toConsumableArray((item._origin.resources || []).filter(function (existingRes) {
|
|
@@ -1816,7 +1954,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1816
1954
|
} else {
|
|
1817
1955
|
var _item$_productOrigin10, _productResources$fin;
|
|
1818
1956
|
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
1819
|
-
var allCartItems = cloneDeep(
|
|
1957
|
+
var allCartItems = cloneDeep(_this9.store.cart.getItems());
|
|
1820
1958
|
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
1821
1959
|
var selectedResources = [];
|
|
1822
1960
|
var _resources = cloneDeep(((_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.product_resource) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.resources) || []);
|
|
@@ -1875,7 +2013,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1875
2013
|
} else {
|
|
1876
2014
|
selectResourcesMap[targetResource.id] += currentCapacity;
|
|
1877
2015
|
}
|
|
1878
|
-
|
|
2016
|
+
_this9.store.cart.updateItem({
|
|
1879
2017
|
_id: item._id,
|
|
1880
2018
|
resources: [].concat(_toConsumableArray((item._origin.resources || []).filter(function (existingRes) {
|
|
1881
2019
|
return existingRes.resourceType !== targetRenderList[0].resourceType;
|
|
@@ -1893,7 +2031,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1893
2031
|
// 如果购物车里没有 holderid数据,证明不按 holder 类流程预约走,给所有购物车一次性分派即可,不做账号下资源互斥逻辑
|
|
1894
2032
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].holder_id) {
|
|
1895
2033
|
accountList.forEach(function (account) {
|
|
1896
|
-
var cartItems =
|
|
2034
|
+
var cartItems = _this9.store.cart.getCartByAccount(account.getId());
|
|
1897
2035
|
selectForCartResources(cartItems);
|
|
1898
2036
|
});
|
|
1899
2037
|
} else {
|
|
@@ -1908,9 +2046,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1908
2046
|
key: "getTimeSlotByAllResources",
|
|
1909
2047
|
value: function getTimeSlotByAllResources(resources_code) {
|
|
1910
2048
|
var _dateRange,
|
|
1911
|
-
|
|
1912
|
-
_cartItems
|
|
1913
|
-
_cartItems$
|
|
2049
|
+
_this10 = this,
|
|
2050
|
+
_cartItems$3,
|
|
2051
|
+
_cartItems$4;
|
|
1914
2052
|
var dateRange = this.store.date.getDateRange();
|
|
1915
2053
|
// 取出购物车中所有一已选择的第一步资源
|
|
1916
2054
|
var resources = [];
|
|
@@ -1973,7 +2111,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1973
2111
|
};
|
|
1974
2112
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].holder_id) {
|
|
1975
2113
|
accountList.forEach(function (account) {
|
|
1976
|
-
var cartItems =
|
|
2114
|
+
var cartItems = _this10.store.cart.getCartByAccount(account.getId());
|
|
1977
2115
|
checkDuration(cartItems);
|
|
1978
2116
|
});
|
|
1979
2117
|
} else {
|
|
@@ -1981,18 +2119,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1981
2119
|
}
|
|
1982
2120
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
1983
2121
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
1984
|
-
if (!(cartItems !== null && cartItems !== void 0 && (_cartItems$ = cartItems[0]) !== null && _cartItems$ !== void 0 && _cartItems
|
|
2122
|
+
if (!(cartItems !== null && cartItems !== void 0 && (_cartItems$3 = cartItems[0]) !== null && _cartItems$3 !== void 0 && _cartItems$3.start_date) && !(cartItems !== null && cartItems !== void 0 && (_cartItems$4 = cartItems[0]) !== null && _cartItems$4 !== void 0 && _cartItems$4.resource_id) || !(cartItems !== null && cartItems !== void 0 && cartItems[0].duration)) {
|
|
1985
2123
|
return [];
|
|
1986
2124
|
}
|
|
1987
2125
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].start_date && !dateRange) {
|
|
1988
|
-
var _cartItems$
|
|
2126
|
+
var _cartItems$5, _cartItems$6;
|
|
1989
2127
|
dateRange = [{
|
|
1990
2128
|
date: cartItems === null || cartItems === void 0 ? void 0 : cartItems[0].start_date,
|
|
1991
2129
|
status: 'available',
|
|
1992
2130
|
week: '',
|
|
1993
2131
|
weekNum: 0
|
|
1994
2132
|
}, {
|
|
1995
|
-
date: (cartItems === null || cartItems === void 0 || (_cartItems$
|
|
2133
|
+
date: (cartItems === null || cartItems === void 0 || (_cartItems$5 = cartItems[0]) === null || _cartItems$5 === void 0 ? void 0 : _cartItems$5.end_date) || (cartItems === null || cartItems === void 0 || (_cartItems$6 = cartItems[0]) === null || _cartItems$6 === void 0 ? void 0 : _cartItems$6.start_date) || '',
|
|
1996
2134
|
status: 'available',
|
|
1997
2135
|
week: '',
|
|
1998
2136
|
weekNum: 0
|
|
@@ -2014,7 +2152,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2014
2152
|
}, {
|
|
2015
2153
|
key: "submitTimeSlot",
|
|
2016
2154
|
value: function submitTimeSlot(timeSlots) {
|
|
2017
|
-
var
|
|
2155
|
+
var _this11 = this;
|
|
2018
2156
|
// 以账号为维度处理数据。购物车里每一项的 startTime应该是前一个商品的 endTime,如果是第一个商品则用 timeSlots.start_at
|
|
2019
2157
|
var cartItems = cloneDeep(this.store.cart.getItems());
|
|
2020
2158
|
|
|
@@ -2040,7 +2178,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2040
2178
|
resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$6 = (_item$_productOrigin16 = item._productOrigin) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.duration) === null || _item$_productOrigin16 === void 0 ? void 0 : _item$_productOrigin16.value) !== null && _item$_productOrigin$6 !== void 0 ? _item$_productOrigin$6 : 0, (_ref11 = (_item$_productOrigin17 = item._productOrigin) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.duration) === null || _item$_productOrigin17 === void 0 ? void 0 : _item$_productOrigin17.type) !== null && _ref11 !== void 0 ? _ref11 : 'minutes').format('YYYY-MM-DD HH:mm');
|
|
2041
2179
|
delete resource.times;
|
|
2042
2180
|
});
|
|
2043
|
-
|
|
2181
|
+
_this11.store.cart.updateItem({
|
|
2044
2182
|
_id: item._id,
|
|
2045
2183
|
resources: newResources
|
|
2046
2184
|
});
|
|
@@ -2088,15 +2226,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2088
2226
|
}, {
|
|
2089
2227
|
key: "openProductDetail",
|
|
2090
2228
|
value: function () {
|
|
2091
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2229
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(productId) {
|
|
2092
2230
|
var targetProduct, targetProductData, newScheduleArr;
|
|
2093
|
-
return _regeneratorRuntime().wrap(function
|
|
2094
|
-
while (1) switch (
|
|
2231
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2232
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2095
2233
|
case 0:
|
|
2096
|
-
|
|
2234
|
+
_context27.next = 2;
|
|
2097
2235
|
return this.store.products.getProduct(productId);
|
|
2098
2236
|
case 2:
|
|
2099
|
-
targetProduct =
|
|
2237
|
+
targetProduct = _context27.sent;
|
|
2100
2238
|
if (targetProduct) {
|
|
2101
2239
|
targetProductData = targetProduct.getData();
|
|
2102
2240
|
this.store.currentProduct = targetProduct;
|
|
@@ -2105,11 +2243,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2105
2243
|
}
|
|
2106
2244
|
case 4:
|
|
2107
2245
|
case "end":
|
|
2108
|
-
return
|
|
2246
|
+
return _context27.stop();
|
|
2109
2247
|
}
|
|
2110
|
-
},
|
|
2248
|
+
}, _callee26, this);
|
|
2111
2249
|
}));
|
|
2112
|
-
function openProductDetail(
|
|
2250
|
+
function openProductDetail(_x19) {
|
|
2113
2251
|
return _openProductDetail.apply(this, arguments);
|
|
2114
2252
|
}
|
|
2115
2253
|
return openProductDetail;
|
|
@@ -2227,7 +2365,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2227
2365
|
}, {
|
|
2228
2366
|
key: "addProductToCart",
|
|
2229
2367
|
value: function addProductToCart(_ref13) {
|
|
2230
|
-
var
|
|
2368
|
+
var _this12 = this;
|
|
2231
2369
|
var product = _ref13.product,
|
|
2232
2370
|
date = _ref13.date,
|
|
2233
2371
|
account = _ref13.account;
|
|
@@ -2260,7 +2398,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2260
2398
|
});
|
|
2261
2399
|
if (cartItemsByDate.length) {
|
|
2262
2400
|
cartItemsByDate.forEach(function (n) {
|
|
2263
|
-
|
|
2401
|
+
_this12.store.cart.removeItem(n._id);
|
|
2264
2402
|
});
|
|
2265
2403
|
}
|
|
2266
2404
|
}
|
|
@@ -2286,29 +2424,29 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2286
2424
|
}, {
|
|
2287
2425
|
key: "getProductTypeById",
|
|
2288
2426
|
value: function () {
|
|
2289
|
-
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2427
|
+
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(id) {
|
|
2290
2428
|
var product;
|
|
2291
|
-
return _regeneratorRuntime().wrap(function
|
|
2292
|
-
while (1) switch (
|
|
2429
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
2430
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2293
2431
|
case 0:
|
|
2294
|
-
|
|
2432
|
+
_context28.next = 2;
|
|
2295
2433
|
return this.store.products.getProduct(id);
|
|
2296
2434
|
case 2:
|
|
2297
|
-
product =
|
|
2435
|
+
product = _context28.sent;
|
|
2298
2436
|
if (!product) {
|
|
2299
|
-
|
|
2437
|
+
_context28.next = 5;
|
|
2300
2438
|
break;
|
|
2301
2439
|
}
|
|
2302
|
-
return
|
|
2440
|
+
return _context28.abrupt("return", product.getProductType());
|
|
2303
2441
|
case 5:
|
|
2304
|
-
return
|
|
2442
|
+
return _context28.abrupt("return", 'normal');
|
|
2305
2443
|
case 6:
|
|
2306
2444
|
case "end":
|
|
2307
|
-
return
|
|
2445
|
+
return _context28.stop();
|
|
2308
2446
|
}
|
|
2309
|
-
},
|
|
2447
|
+
}, _callee27, this);
|
|
2310
2448
|
}));
|
|
2311
|
-
function getProductTypeById(
|
|
2449
|
+
function getProductTypeById(_x20) {
|
|
2312
2450
|
return _getProductTypeById.apply(this, arguments);
|
|
2313
2451
|
}
|
|
2314
2452
|
return getProductTypeById;
|