@pisell/pisellos 3.0.26 → 3.0.27
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 +389 -239
- 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 +75 -0
- package/package.json +1 -1
|
@@ -204,7 +204,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
204
204
|
value: function () {
|
|
205
205
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
206
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;
|
|
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, _userPlugin$get, 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,15 @@ 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 = undefined;
|
|
226
|
+
try {
|
|
227
|
+
customer_id = userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id;
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.error(error);
|
|
230
|
+
}
|
|
231
|
+
// 如果没传schedule_date,则从
|
|
232
|
+
_context2.next = 7;
|
|
225
233
|
return this.request.post("/product/query", {
|
|
226
234
|
open_quotation: 1,
|
|
227
235
|
open_bundle: 1,
|
|
@@ -230,6 +238,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
230
238
|
status: 'published',
|
|
231
239
|
num: 500,
|
|
232
240
|
skip: 1,
|
|
241
|
+
customer_id: customer_id,
|
|
233
242
|
category_ids: category_ids,
|
|
234
243
|
ids: product_ids,
|
|
235
244
|
collection: collection,
|
|
@@ -239,11 +248,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
239
248
|
}, {
|
|
240
249
|
useCache: true
|
|
241
250
|
});
|
|
242
|
-
case
|
|
251
|
+
case 7:
|
|
243
252
|
productsData = _context2.sent;
|
|
244
253
|
this.store.products.addProduct(productsData.data.list);
|
|
245
254
|
return _context2.abrupt("return", productsData.data.list);
|
|
246
|
-
case
|
|
255
|
+
case 10:
|
|
247
256
|
case "end":
|
|
248
257
|
return _context2.stop();
|
|
249
258
|
}
|
|
@@ -299,30 +308,148 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
299
308
|
return _loadProductByScheduleDate.apply(this, arguments);
|
|
300
309
|
}
|
|
301
310
|
return loadProductByScheduleDate;
|
|
311
|
+
}()
|
|
312
|
+
}, {
|
|
313
|
+
key: "updateQuotationPriceAndCart",
|
|
314
|
+
value: function () {
|
|
315
|
+
var _updateQuotationPriceAndCart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(date) {
|
|
316
|
+
var _this$otherParams3,
|
|
317
|
+
_this3 = this;
|
|
318
|
+
var dateRange, scheduleList, scheduleIds, cartItems, _iterator, _step, _loop;
|
|
319
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
320
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
321
|
+
case 0:
|
|
322
|
+
dateRange = this.store.date.getDateRange();
|
|
323
|
+
scheduleList = this.store.schedule.getAvailabilityScheduleDateList() || [];
|
|
324
|
+
scheduleIds = [];
|
|
325
|
+
if (dateRange && dateRange.length) {
|
|
326
|
+
scheduleIds = scheduleList.filter(function (n) {
|
|
327
|
+
return n.date === dateRange[0].date;
|
|
328
|
+
}).flatMap(function (n) {
|
|
329
|
+
return n.schedule_id;
|
|
330
|
+
});
|
|
331
|
+
} else {
|
|
332
|
+
scheduleIds = scheduleList.filter(function (n) {
|
|
333
|
+
return n.date === date;
|
|
334
|
+
}).flatMap(function (n) {
|
|
335
|
+
return n.schedule_id;
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
_context5.next = 6;
|
|
339
|
+
return this.loadProducts(_objectSpread(_objectSpread({}, (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.productModuleParams), {}, {
|
|
340
|
+
scheduleIds: scheduleIds,
|
|
341
|
+
schedule_date: date
|
|
342
|
+
}));
|
|
343
|
+
case 6:
|
|
344
|
+
// 更新完商品数据以后,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
|
|
345
|
+
cartItems = this.store.cart.getItems();
|
|
346
|
+
if (!cartItems.length) {
|
|
347
|
+
_context5.next = 25;
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
_iterator = _createForOfIteratorHelper(cartItems);
|
|
351
|
+
_context5.prev = 9;
|
|
352
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
353
|
+
var _bundle;
|
|
354
|
+
var item, targetProduct, productInfo, bundle;
|
|
355
|
+
return _regeneratorRuntime().wrap(function _loop$(_context4) {
|
|
356
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
357
|
+
case 0:
|
|
358
|
+
item = _step.value;
|
|
359
|
+
_context4.next = 3;
|
|
360
|
+
return _this3.store.products.getProduct(item.id);
|
|
361
|
+
case 3:
|
|
362
|
+
targetProduct = _context4.sent;
|
|
363
|
+
productInfo = cloneDeep(targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.getData());
|
|
364
|
+
bundle = item._bundleOrigin;
|
|
365
|
+
bundle = (_bundle = bundle) === null || _bundle === void 0 ? void 0 : _bundle.map(function (n) {
|
|
366
|
+
var _productInfo$bundle;
|
|
367
|
+
// 尝试到新的 productInfo 里找对应的 bundleitem
|
|
368
|
+
// 然后更新 bundle 的价格
|
|
369
|
+
var targetBundle = productInfo === null || productInfo === void 0 || (_productInfo$bundle = productInfo.bundle) === null || _productInfo$bundle === void 0 ? void 0 : _productInfo$bundle.find(function (m) {
|
|
370
|
+
return m.group_id === n.id;
|
|
371
|
+
});
|
|
372
|
+
if (targetBundle) {
|
|
373
|
+
var targetBundleItem = targetBundle.items.find(function (m) {
|
|
374
|
+
return m.id === n.id;
|
|
375
|
+
});
|
|
376
|
+
if (targetBundleItem) {
|
|
377
|
+
return _objectSpread(_objectSpread({}, n), {}, {
|
|
378
|
+
price: targetBundleItem.price,
|
|
379
|
+
base_price: targetBundleItem.base_price
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return n;
|
|
384
|
+
});
|
|
385
|
+
_this3.store.cart.updateItem({
|
|
386
|
+
_id: item._id,
|
|
387
|
+
product: productInfo,
|
|
388
|
+
bundle: bundle
|
|
389
|
+
});
|
|
390
|
+
case 8:
|
|
391
|
+
case "end":
|
|
392
|
+
return _context4.stop();
|
|
393
|
+
}
|
|
394
|
+
}, _loop);
|
|
395
|
+
});
|
|
396
|
+
_iterator.s();
|
|
397
|
+
case 12:
|
|
398
|
+
if ((_step = _iterator.n()).done) {
|
|
399
|
+
_context5.next = 16;
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
return _context5.delegateYield(_loop(), "t0", 14);
|
|
403
|
+
case 14:
|
|
404
|
+
_context5.next = 12;
|
|
405
|
+
break;
|
|
406
|
+
case 16:
|
|
407
|
+
_context5.next = 21;
|
|
408
|
+
break;
|
|
409
|
+
case 18:
|
|
410
|
+
_context5.prev = 18;
|
|
411
|
+
_context5.t1 = _context5["catch"](9);
|
|
412
|
+
_iterator.e(_context5.t1);
|
|
413
|
+
case 21:
|
|
414
|
+
_context5.prev = 21;
|
|
415
|
+
_iterator.f();
|
|
416
|
+
return _context5.finish(21);
|
|
417
|
+
case 24:
|
|
418
|
+
;
|
|
419
|
+
case 25:
|
|
420
|
+
case "end":
|
|
421
|
+
return _context5.stop();
|
|
422
|
+
}
|
|
423
|
+
}, _callee4, this, [[9, 18, 21, 24]]);
|
|
424
|
+
}));
|
|
425
|
+
function updateQuotationPriceAndCart(_x5) {
|
|
426
|
+
return _updateQuotationPriceAndCart.apply(this, arguments);
|
|
427
|
+
}
|
|
428
|
+
return updateQuotationPriceAndCart;
|
|
302
429
|
}() // 加载当前店铺下所有 schedule
|
|
303
430
|
}, {
|
|
304
431
|
key: "loadAllSchedule",
|
|
305
432
|
value: function () {
|
|
306
|
-
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
433
|
+
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
307
434
|
var _scheduleList$data;
|
|
308
435
|
var scheduleList;
|
|
309
|
-
return _regeneratorRuntime().wrap(function
|
|
310
|
-
while (1) switch (
|
|
436
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
437
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
311
438
|
case 0:
|
|
312
|
-
|
|
439
|
+
_context6.next = 2;
|
|
313
440
|
return this.request.get("/schedule", {
|
|
314
441
|
num: 999
|
|
315
442
|
}, {
|
|
316
443
|
useCache: true
|
|
317
444
|
});
|
|
318
445
|
case 2:
|
|
319
|
-
scheduleList =
|
|
446
|
+
scheduleList = _context6.sent;
|
|
320
447
|
this.store.schedule.setScheduleList(((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []);
|
|
321
448
|
case 4:
|
|
322
449
|
case "end":
|
|
323
|
-
return
|
|
450
|
+
return _context6.stop();
|
|
324
451
|
}
|
|
325
|
-
},
|
|
452
|
+
}, _callee5, this);
|
|
326
453
|
}));
|
|
327
454
|
function loadAllSchedule() {
|
|
328
455
|
return _loadAllSchedule.apply(this, arguments);
|
|
@@ -332,11 +459,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
332
459
|
}, {
|
|
333
460
|
key: "loadScheduleAvailableDate",
|
|
334
461
|
value: function () {
|
|
335
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
462
|
+
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref3) {
|
|
336
463
|
var _res$data$date_list;
|
|
337
464
|
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
338
|
-
return _regeneratorRuntime().wrap(function
|
|
339
|
-
while (1) switch (
|
|
465
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
466
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
340
467
|
case 0:
|
|
341
468
|
startDate = _ref3.startDate, endDate = _ref3.endDate, custom_page_id = _ref3.custom_page_id, channel = _ref3.channel;
|
|
342
469
|
// 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天,需要把 startDate 置为今天
|
|
@@ -348,12 +475,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
348
475
|
dates = disableAllDates(dates);
|
|
349
476
|
// 如果 endDate 在今天之前,则不用查接口,直接返回 dates
|
|
350
477
|
if (!dayjs(endDate).isBefore(dayjs(), 'day')) {
|
|
351
|
-
|
|
478
|
+
_context7.next = 6;
|
|
352
479
|
break;
|
|
353
480
|
}
|
|
354
|
-
return
|
|
481
|
+
return _context7.abrupt("return", dates);
|
|
355
482
|
case 6:
|
|
356
|
-
|
|
483
|
+
_context7.next = 8;
|
|
357
484
|
return this.request.get("/schedule/product/availability", {
|
|
358
485
|
start_date: startDate,
|
|
359
486
|
end_date: endDate,
|
|
@@ -361,14 +488,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
361
488
|
channel: channel
|
|
362
489
|
});
|
|
363
490
|
case 8:
|
|
364
|
-
res =
|
|
491
|
+
res = _context7.sent;
|
|
365
492
|
this.store.schedule.setAvailabilityScheduleDateList(res.data.date_list);
|
|
366
493
|
// 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
|
|
367
494
|
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
|
-
|
|
495
|
+
_context7.next = 12;
|
|
369
496
|
break;
|
|
370
497
|
}
|
|
371
|
-
return
|
|
498
|
+
return _context7.abrupt("return", dates);
|
|
372
499
|
case 12:
|
|
373
500
|
res.data.date_list.forEach(function (n) {
|
|
374
501
|
var index = dates.findIndex(function (m) {
|
|
@@ -379,14 +506,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
379
506
|
}
|
|
380
507
|
});
|
|
381
508
|
dates = disableDatesBeforeOneDay(dates);
|
|
382
|
-
return
|
|
509
|
+
return _context7.abrupt("return", dates);
|
|
383
510
|
case 15:
|
|
384
511
|
case "end":
|
|
385
|
-
return
|
|
512
|
+
return _context7.stop();
|
|
386
513
|
}
|
|
387
|
-
},
|
|
514
|
+
}, _callee6, this);
|
|
388
515
|
}));
|
|
389
|
-
function loadScheduleAvailableDate(
|
|
516
|
+
function loadScheduleAvailableDate(_x6) {
|
|
390
517
|
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
391
518
|
}
|
|
392
519
|
return loadScheduleAvailableDate;
|
|
@@ -394,10 +521,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
394
521
|
}, {
|
|
395
522
|
key: "storeProduct",
|
|
396
523
|
value: function () {
|
|
397
|
-
var _storeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
524
|
+
var _storeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(productData) {
|
|
398
525
|
var activeAccount, _ref4, bundle, options, origin, product_variant_id, product, addCartItem;
|
|
399
|
-
return _regeneratorRuntime().wrap(function
|
|
400
|
-
while (1) switch (
|
|
526
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
527
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
401
528
|
case 0:
|
|
402
529
|
// 往购物车加商品数据的时候,默认用当前 activeAccount 填充到 product 的 account 里面
|
|
403
530
|
activeAccount = this.getActiveAccount();
|
|
@@ -416,11 +543,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
416
543
|
this.store.cart.addItem(addCartItem);
|
|
417
544
|
case 6:
|
|
418
545
|
case "end":
|
|
419
|
-
return
|
|
546
|
+
return _context8.stop();
|
|
420
547
|
}
|
|
421
|
-
},
|
|
548
|
+
}, _callee7, this);
|
|
422
549
|
}));
|
|
423
|
-
function storeProduct(
|
|
550
|
+
function storeProduct(_x7) {
|
|
424
551
|
return _storeProduct.apply(this, arguments);
|
|
425
552
|
}
|
|
426
553
|
return storeProduct;
|
|
@@ -428,37 +555,37 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
428
555
|
}, {
|
|
429
556
|
key: "addAccount",
|
|
430
557
|
value: function () {
|
|
431
|
-
var _addAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
558
|
+
var _addAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(account, extra) {
|
|
432
559
|
var accountModules, newAccount;
|
|
433
|
-
return _regeneratorRuntime().wrap(function
|
|
434
|
-
while (1) switch (
|
|
560
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
561
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
435
562
|
case 0:
|
|
436
563
|
if (!((extra === null || extra === void 0 ? void 0 : extra.type) === 'holder')) {
|
|
437
|
-
|
|
564
|
+
_context9.next = 5;
|
|
438
565
|
break;
|
|
439
566
|
}
|
|
440
|
-
|
|
567
|
+
_context9.next = 3;
|
|
441
568
|
return this.store.accountList.addHolderAccounts({
|
|
442
569
|
holders: [account],
|
|
443
570
|
customerId: extra.customerId,
|
|
444
571
|
type: 'unshift'
|
|
445
572
|
});
|
|
446
573
|
case 3:
|
|
447
|
-
accountModules =
|
|
448
|
-
return
|
|
574
|
+
accountModules = _context9.sent;
|
|
575
|
+
return _context9.abrupt("return", accountModules[0].getAccount());
|
|
449
576
|
case 5:
|
|
450
|
-
|
|
577
|
+
_context9.next = 7;
|
|
451
578
|
return this.store.accountList.addAccount(account);
|
|
452
579
|
case 7:
|
|
453
|
-
newAccount =
|
|
454
|
-
return
|
|
580
|
+
newAccount = _context9.sent;
|
|
581
|
+
return _context9.abrupt("return", newAccount.getAccount());
|
|
455
582
|
case 9:
|
|
456
583
|
case "end":
|
|
457
|
-
return
|
|
584
|
+
return _context9.stop();
|
|
458
585
|
}
|
|
459
|
-
},
|
|
586
|
+
}, _callee8, this);
|
|
460
587
|
}));
|
|
461
|
-
function addAccount(
|
|
588
|
+
function addAccount(_x8, _x9) {
|
|
462
589
|
return _addAccount.apply(this, arguments);
|
|
463
590
|
}
|
|
464
591
|
return addAccount;
|
|
@@ -466,13 +593,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
466
593
|
}, {
|
|
467
594
|
key: "addAccounts",
|
|
468
595
|
value: function () {
|
|
469
|
-
var _addAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
470
|
-
var res,
|
|
471
|
-
return _regeneratorRuntime().wrap(function
|
|
472
|
-
while (1) switch (
|
|
596
|
+
var _addAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(accounts, extra) {
|
|
597
|
+
var res, _iterator2, _step2, account, accountModule, accountData;
|
|
598
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
599
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
473
600
|
case 0:
|
|
474
601
|
if (!((extra === null || extra === void 0 ? void 0 : extra.type) === 'holder')) {
|
|
475
|
-
|
|
602
|
+
_context10.next = 3;
|
|
476
603
|
break;
|
|
477
604
|
}
|
|
478
605
|
this.store.accountList.addHolderAccounts({
|
|
@@ -480,49 +607,49 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
480
607
|
customerId: extra.customerId,
|
|
481
608
|
type: 'unshift'
|
|
482
609
|
});
|
|
483
|
-
return
|
|
610
|
+
return _context10.abrupt("return");
|
|
484
611
|
case 3:
|
|
485
612
|
res = [];
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
613
|
+
_iterator2 = _createForOfIteratorHelper(accounts);
|
|
614
|
+
_context10.prev = 5;
|
|
615
|
+
_iterator2.s();
|
|
489
616
|
case 7:
|
|
490
|
-
if ((
|
|
491
|
-
|
|
617
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
618
|
+
_context10.next = 16;
|
|
492
619
|
break;
|
|
493
620
|
}
|
|
494
|
-
account =
|
|
495
|
-
|
|
621
|
+
account = _step2.value;
|
|
622
|
+
_context10.next = 11;
|
|
496
623
|
return this.store.accountList.addAccount(account);
|
|
497
624
|
case 11:
|
|
498
|
-
accountModule =
|
|
625
|
+
accountModule = _context10.sent;
|
|
499
626
|
accountData = accountModule.getAccount();
|
|
500
627
|
if (accountData) {
|
|
501
628
|
res.push(accountData);
|
|
502
629
|
}
|
|
503
630
|
case 14:
|
|
504
|
-
|
|
631
|
+
_context10.next = 7;
|
|
505
632
|
break;
|
|
506
633
|
case 16:
|
|
507
|
-
|
|
634
|
+
_context10.next = 21;
|
|
508
635
|
break;
|
|
509
636
|
case 18:
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
637
|
+
_context10.prev = 18;
|
|
638
|
+
_context10.t0 = _context10["catch"](5);
|
|
639
|
+
_iterator2.e(_context10.t0);
|
|
513
640
|
case 21:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
return
|
|
641
|
+
_context10.prev = 21;
|
|
642
|
+
_iterator2.f();
|
|
643
|
+
return _context10.finish(21);
|
|
517
644
|
case 24:
|
|
518
|
-
return
|
|
645
|
+
return _context10.abrupt("return", res);
|
|
519
646
|
case 25:
|
|
520
647
|
case "end":
|
|
521
|
-
return
|
|
648
|
+
return _context10.stop();
|
|
522
649
|
}
|
|
523
|
-
},
|
|
650
|
+
}, _callee9, this, [[5, 18, 21, 24]]);
|
|
524
651
|
}));
|
|
525
|
-
function addAccounts(
|
|
652
|
+
function addAccounts(_x10, _x11) {
|
|
526
653
|
return _addAccounts.apply(this, arguments);
|
|
527
654
|
}
|
|
528
655
|
return addAccounts;
|
|
@@ -530,20 +657,20 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
530
657
|
}, {
|
|
531
658
|
key: "getAccounts",
|
|
532
659
|
value: function () {
|
|
533
|
-
var _getAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
660
|
+
var _getAccounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
534
661
|
var accounts;
|
|
535
|
-
return _regeneratorRuntime().wrap(function
|
|
536
|
-
while (1) switch (
|
|
662
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
663
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
537
664
|
case 0:
|
|
538
665
|
accounts = this.store.accountList.getAccounts();
|
|
539
|
-
return
|
|
666
|
+
return _context11.abrupt("return", accounts.map(function (account) {
|
|
540
667
|
return account.getAccount();
|
|
541
668
|
}));
|
|
542
669
|
case 2:
|
|
543
670
|
case "end":
|
|
544
|
-
return
|
|
671
|
+
return _context11.stop();
|
|
545
672
|
}
|
|
546
|
-
},
|
|
673
|
+
}, _callee10, this);
|
|
547
674
|
}));
|
|
548
675
|
function getAccounts() {
|
|
549
676
|
return _getAccounts.apply(this, arguments);
|
|
@@ -584,18 +711,28 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
584
711
|
}, {
|
|
585
712
|
key: "fetchHolderAccountsAsync",
|
|
586
713
|
value: (function () {
|
|
587
|
-
var _fetchHolderAccountsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
588
|
-
|
|
589
|
-
|
|
714
|
+
var _fetchHolderAccountsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
715
|
+
var cartItems, _this$store$date$getD, date, _cartItems$;
|
|
716
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context12) {
|
|
717
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
590
718
|
case 0:
|
|
591
|
-
|
|
592
|
-
|
|
719
|
+
cartItems = this.store.cart.getItems();
|
|
720
|
+
if (cartItems.length) {
|
|
721
|
+
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;
|
|
722
|
+
if (!date) {
|
|
723
|
+
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
724
|
+
date = (cartItems === null || cartItems === void 0 || (_cartItems$ = cartItems[0]) === null || _cartItems$ === void 0 ? void 0 : _cartItems$.start_date) || '';
|
|
725
|
+
}
|
|
726
|
+
this.updateQuotationPriceAndCart(date);
|
|
727
|
+
}
|
|
728
|
+
return _context12.abrupt("return", this.store.accountList.fetchHolderAccounts(params));
|
|
729
|
+
case 3:
|
|
593
730
|
case "end":
|
|
594
|
-
return
|
|
731
|
+
return _context12.stop();
|
|
595
732
|
}
|
|
596
|
-
},
|
|
733
|
+
}, _callee11, this);
|
|
597
734
|
}));
|
|
598
|
-
function fetchHolderAccountsAsync(
|
|
735
|
+
function fetchHolderAccountsAsync(_x12) {
|
|
599
736
|
return _fetchHolderAccountsAsync.apply(this, arguments);
|
|
600
737
|
}
|
|
601
738
|
return fetchHolderAccountsAsync;
|
|
@@ -604,18 +741,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
604
741
|
}, {
|
|
605
742
|
key: "setDateRange",
|
|
606
743
|
value: function () {
|
|
607
|
-
var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
608
|
-
return _regeneratorRuntime().wrap(function
|
|
609
|
-
while (1) switch (
|
|
744
|
+
var _setDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(dateRange) {
|
|
745
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context13) {
|
|
746
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
610
747
|
case 0:
|
|
611
748
|
this.store.date.setDateRange(dateRange);
|
|
612
|
-
|
|
749
|
+
// 日期数据变更后,如果购物车里有数据,需要更新购物车里的报价单的价格
|
|
750
|
+
if (dateRange.length && this.store.cart.getItems().length) {
|
|
751
|
+
this.updateQuotationPriceAndCart(dateRange[0].date);
|
|
752
|
+
}
|
|
753
|
+
case 2:
|
|
613
754
|
case "end":
|
|
614
|
-
return
|
|
755
|
+
return _context13.stop();
|
|
615
756
|
}
|
|
616
|
-
},
|
|
757
|
+
}, _callee12, this);
|
|
617
758
|
}));
|
|
618
|
-
function setDateRange(
|
|
759
|
+
function setDateRange(_x13) {
|
|
619
760
|
return _setDateRange.apply(this, arguments);
|
|
620
761
|
}
|
|
621
762
|
return setDateRange;
|
|
@@ -630,16 +771,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
630
771
|
}, {
|
|
631
772
|
key: "getDateRange",
|
|
632
773
|
value: function () {
|
|
633
|
-
var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
634
|
-
return _regeneratorRuntime().wrap(function
|
|
635
|
-
while (1) switch (
|
|
774
|
+
var _getDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
775
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context14) {
|
|
776
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
636
777
|
case 0:
|
|
637
|
-
return
|
|
778
|
+
return _context14.abrupt("return", this.store.date.getDateRange());
|
|
638
779
|
case 1:
|
|
639
780
|
case "end":
|
|
640
|
-
return
|
|
781
|
+
return _context14.stop();
|
|
641
782
|
}
|
|
642
|
-
},
|
|
783
|
+
}, _callee13, this);
|
|
643
784
|
}));
|
|
644
785
|
function getDateRange() {
|
|
645
786
|
return _getDateRange.apply(this, arguments);
|
|
@@ -656,8 +797,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
656
797
|
}, {
|
|
657
798
|
key: "getAvailableDate",
|
|
658
799
|
value: function () {
|
|
659
|
-
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
660
|
-
var
|
|
800
|
+
var _getAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
801
|
+
var _this4 = this,
|
|
661
802
|
_dateRange$,
|
|
662
803
|
_dateRange$2,
|
|
663
804
|
_dateRange$3;
|
|
@@ -675,11 +816,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
675
816
|
rules,
|
|
676
817
|
resourcesMap,
|
|
677
818
|
res,
|
|
678
|
-
|
|
679
|
-
return _regeneratorRuntime().wrap(function
|
|
680
|
-
while (1) switch (
|
|
819
|
+
_args15 = arguments;
|
|
820
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context15) {
|
|
821
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
681
822
|
case 0:
|
|
682
|
-
params =
|
|
823
|
+
params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
683
824
|
// 开始日期如果小于今天,直接以今天当做开始日期
|
|
684
825
|
products = params.products, startDate = params.startDate, endDate = params.endDate, type = params.type; // 前端传递的 startDate,可能是今天之前的,如果 startDate 小于今天 且 endDate 小于或等于今天,需要把 startDate 置为今天
|
|
685
826
|
if (dayjs(startDate).isBefore(dayjs(), 'day') && (dayjs(endDate).isAfter(dayjs(), 'day') || dayjs(endDate).isSame(dayjs(), 'day'))) {
|
|
@@ -691,7 +832,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
691
832
|
if (tempProducts.length) {
|
|
692
833
|
tempProducts.forEach(function (p) {
|
|
693
834
|
if (p !== null && p !== void 0 && p['schedule.ids']) {
|
|
694
|
-
var scheduleData =
|
|
835
|
+
var scheduleData = _this4.getScheduleDataByIds(p['schedule.ids']);
|
|
695
836
|
p['_schedule'] = scheduleData;
|
|
696
837
|
}
|
|
697
838
|
});
|
|
@@ -706,15 +847,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
706
847
|
tempStartDate = startDate || (dateRange === null || dateRange === void 0 || (_dateRange$ = dateRange[0]) === null || _dateRange$ === void 0 ? void 0 : _dateRange$.date);
|
|
707
848
|
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
849
|
if (tempProducts.length) {
|
|
709
|
-
|
|
850
|
+
_context15.next = 11;
|
|
710
851
|
break;
|
|
711
852
|
}
|
|
712
|
-
return
|
|
853
|
+
return _context15.abrupt("return", []);
|
|
713
854
|
case 11:
|
|
714
855
|
// 在这里需要把能收集到的数据都收集上来,拼装好给 date 模块去查询
|
|
715
856
|
_ref5 = getAvailableProductResources(tempProducts) || {}, resourceIds = _ref5.resourceIds, rules = _ref5.rules, resourcesMap = _ref5.resourcesMap;
|
|
716
857
|
this.otherParams.currentResourcesMap = resourcesMap;
|
|
717
|
-
|
|
858
|
+
_context15.next = 15;
|
|
718
859
|
return this.store.date.getResourceDates({
|
|
719
860
|
url: params.url,
|
|
720
861
|
query: {
|
|
@@ -726,13 +867,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
726
867
|
type: type
|
|
727
868
|
});
|
|
728
869
|
case 15:
|
|
729
|
-
res =
|
|
730
|
-
return
|
|
870
|
+
res = _context15.sent;
|
|
871
|
+
return _context15.abrupt("return", res);
|
|
731
872
|
case 17:
|
|
732
873
|
case "end":
|
|
733
|
-
return
|
|
874
|
+
return _context15.stop();
|
|
734
875
|
}
|
|
735
|
-
},
|
|
876
|
+
}, _callee14, this);
|
|
736
877
|
}));
|
|
737
878
|
function getAvailableDate() {
|
|
738
879
|
return _getAvailableDate.apply(this, arguments);
|
|
@@ -745,22 +886,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
745
886
|
}, {
|
|
746
887
|
key: "getSummary",
|
|
747
888
|
value: (function () {
|
|
748
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
889
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
749
890
|
var cartItems, summary;
|
|
750
|
-
return _regeneratorRuntime().wrap(function
|
|
751
|
-
while (1) switch (
|
|
891
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context16) {
|
|
892
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
752
893
|
case 0:
|
|
753
894
|
cartItems = this.store.cart.getItems();
|
|
754
|
-
|
|
895
|
+
_context16.next = 3;
|
|
755
896
|
return this.store.summary.getSummary(cartItems);
|
|
756
897
|
case 3:
|
|
757
|
-
summary =
|
|
758
|
-
return
|
|
898
|
+
summary = _context16.sent;
|
|
899
|
+
return _context16.abrupt("return", summary);
|
|
759
900
|
case 5:
|
|
760
901
|
case "end":
|
|
761
|
-
return
|
|
902
|
+
return _context16.stop();
|
|
762
903
|
}
|
|
763
|
-
},
|
|
904
|
+
}, _callee15, this);
|
|
764
905
|
}));
|
|
765
906
|
function getSummary() {
|
|
766
907
|
return _getSummary.apply(this, arguments);
|
|
@@ -774,18 +915,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
774
915
|
}, {
|
|
775
916
|
key: "getProtocol",
|
|
776
917
|
value: (function () {
|
|
777
|
-
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
778
|
-
return _regeneratorRuntime().wrap(function
|
|
779
|
-
while (1) switch (
|
|
918
|
+
var _getProtocol = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(protocolId) {
|
|
919
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context17) {
|
|
920
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
780
921
|
case 0:
|
|
781
|
-
return
|
|
922
|
+
return _context17.abrupt("return", this.store.summary.getProtocol(protocolId));
|
|
782
923
|
case 1:
|
|
783
924
|
case "end":
|
|
784
|
-
return
|
|
925
|
+
return _context17.stop();
|
|
785
926
|
}
|
|
786
|
-
},
|
|
927
|
+
}, _callee16, this);
|
|
787
928
|
}));
|
|
788
|
-
function getProtocol(
|
|
929
|
+
function getProtocol(_x14) {
|
|
789
930
|
return _getProtocol.apply(this, arguments);
|
|
790
931
|
}
|
|
791
932
|
return getProtocol;
|
|
@@ -794,16 +935,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
794
935
|
}, {
|
|
795
936
|
key: "getProducts",
|
|
796
937
|
value: function () {
|
|
797
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
798
|
-
return _regeneratorRuntime().wrap(function
|
|
799
|
-
while (1) switch (
|
|
938
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
939
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context18) {
|
|
940
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
800
941
|
case 0:
|
|
801
|
-
return
|
|
942
|
+
return _context18.abrupt("return", this.store.products.getProducts());
|
|
802
943
|
case 1:
|
|
803
944
|
case "end":
|
|
804
|
-
return
|
|
945
|
+
return _context18.stop();
|
|
805
946
|
}
|
|
806
|
-
},
|
|
947
|
+
}, _callee17, this);
|
|
807
948
|
}));
|
|
808
949
|
function getProducts() {
|
|
809
950
|
return _getProducts.apply(this, arguments);
|
|
@@ -813,41 +954,50 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
813
954
|
}, {
|
|
814
955
|
key: "setLoginAccount",
|
|
815
956
|
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 (
|
|
957
|
+
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(accountId, accountInfo) {
|
|
958
|
+
var _this5 = this;
|
|
959
|
+
var account, stateAccountId, cartItems, _this$store$date$getD2, date, _cartItems$2;
|
|
960
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context19) {
|
|
961
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
821
962
|
case 0:
|
|
822
963
|
account = this.store.accountList.getAccount(accountId);
|
|
823
964
|
if (!account) {
|
|
824
|
-
|
|
965
|
+
_context19.next = 11;
|
|
825
966
|
break;
|
|
826
967
|
}
|
|
827
968
|
stateAccountId = account.getId();
|
|
969
|
+
accountInfo.isLogin = true;
|
|
828
970
|
account.setAccountInfo(accountInfo);
|
|
829
971
|
// 然后去购物车,把原先关联了 holder_id 为 accountId 的商品,替换为 holder_id = accountInfo.id
|
|
830
972
|
cartItems = this.store.cart.getItems();
|
|
831
973
|
cartItems.forEach(function (item) {
|
|
832
974
|
if (item.holder_id === accountId) {
|
|
833
|
-
|
|
975
|
+
_this5.store.cart.updateItem({
|
|
834
976
|
_id: item._id,
|
|
835
977
|
account: accountInfo
|
|
836
978
|
});
|
|
837
979
|
}
|
|
838
980
|
});
|
|
839
981
|
this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
|
|
840
|
-
|
|
982
|
+
if (cartItems.length) {
|
|
983
|
+
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;
|
|
984
|
+
if (!date) {
|
|
985
|
+
// 如果没有日期,则应该是 session 类先选商品的流程,直接从购物车里拿 start_date
|
|
986
|
+
date = (cartItems === null || cartItems === void 0 || (_cartItems$2 = cartItems[0]) === null || _cartItems$2 === void 0 ? void 0 : _cartItems$2.start_date) || '';
|
|
987
|
+
}
|
|
988
|
+
this.updateQuotationPriceAndCart(date);
|
|
989
|
+
}
|
|
990
|
+
_context19.next = 12;
|
|
841
991
|
break;
|
|
842
|
-
case
|
|
992
|
+
case 11:
|
|
843
993
|
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
844
|
-
case
|
|
994
|
+
case 12:
|
|
845
995
|
case "end":
|
|
846
|
-
return
|
|
996
|
+
return _context19.stop();
|
|
847
997
|
}
|
|
848
|
-
},
|
|
998
|
+
}, _callee18, this);
|
|
849
999
|
}));
|
|
850
|
-
function setLoginAccount(
|
|
1000
|
+
function setLoginAccount(_x15, _x16) {
|
|
851
1001
|
return _setLoginAccount.apply(this, arguments);
|
|
852
1002
|
}
|
|
853
1003
|
return setLoginAccount;
|
|
@@ -855,14 +1005,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
855
1005
|
}, {
|
|
856
1006
|
key: "generateCartData",
|
|
857
1007
|
value: function () {
|
|
858
|
-
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
859
|
-
return _regeneratorRuntime().wrap(function
|
|
860
|
-
while (1) switch (
|
|
1008
|
+
var _generateCartData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1009
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context20) {
|
|
1010
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
861
1011
|
case 0:
|
|
862
1012
|
case "end":
|
|
863
|
-
return
|
|
1013
|
+
return _context20.stop();
|
|
864
1014
|
}
|
|
865
|
-
},
|
|
1015
|
+
}, _callee19);
|
|
866
1016
|
}));
|
|
867
1017
|
function generateCartData() {
|
|
868
1018
|
return _generateCartData.apply(this, arguments);
|
|
@@ -872,23 +1022,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
872
1022
|
}, {
|
|
873
1023
|
key: "getFreeProduct",
|
|
874
1024
|
value: function () {
|
|
875
|
-
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1025
|
+
var _getFreeProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(id) {
|
|
876
1026
|
var res;
|
|
877
|
-
return _regeneratorRuntime().wrap(function
|
|
878
|
-
while (1) switch (
|
|
1027
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context21) {
|
|
1028
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
879
1029
|
case 0:
|
|
880
|
-
|
|
1030
|
+
_context21.next = 2;
|
|
881
1031
|
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
882
1032
|
case 2:
|
|
883
|
-
res =
|
|
884
|
-
return
|
|
1033
|
+
res = _context21.sent;
|
|
1034
|
+
return _context21.abrupt("return", res);
|
|
885
1035
|
case 4:
|
|
886
1036
|
case "end":
|
|
887
|
-
return
|
|
1037
|
+
return _context21.stop();
|
|
888
1038
|
}
|
|
889
|
-
},
|
|
1039
|
+
}, _callee20, this);
|
|
890
1040
|
}));
|
|
891
|
-
function getFreeProduct(
|
|
1041
|
+
function getFreeProduct(_x17) {
|
|
892
1042
|
return _getFreeProduct.apply(this, arguments);
|
|
893
1043
|
}
|
|
894
1044
|
return getFreeProduct;
|
|
@@ -911,10 +1061,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
911
1061
|
}, {
|
|
912
1062
|
key: "submitOrder",
|
|
913
1063
|
value: function () {
|
|
914
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1064
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
915
1065
|
var cartItems, newCartItems;
|
|
916
|
-
return _regeneratorRuntime().wrap(function
|
|
917
|
-
while (1) switch (
|
|
1066
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context22) {
|
|
1067
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
918
1068
|
case 0:
|
|
919
1069
|
cartItems = this.store.cart.getItems();
|
|
920
1070
|
newCartItems = cloneDeep(cartItems); // 先整个临时的逻辑,把购物车里所有商品的资源给他格式化一下
|
|
@@ -940,16 +1090,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
940
1090
|
item._origin.metadata.capacity = formatCapacity;
|
|
941
1091
|
item._origin.number = currentCapacity;
|
|
942
1092
|
});
|
|
943
|
-
return
|
|
1093
|
+
return _context22.abrupt("return", this.store.order.submitOrder({
|
|
944
1094
|
query: {
|
|
945
1095
|
cartItems: newCartItems
|
|
946
1096
|
}
|
|
947
1097
|
}));
|
|
948
1098
|
case 4:
|
|
949
1099
|
case "end":
|
|
950
|
-
return
|
|
1100
|
+
return _context22.stop();
|
|
951
1101
|
}
|
|
952
|
-
},
|
|
1102
|
+
}, _callee21, this);
|
|
953
1103
|
}));
|
|
954
1104
|
function submitOrder() {
|
|
955
1105
|
return _submitOrder.apply(this, arguments);
|
|
@@ -959,14 +1109,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
959
1109
|
}, {
|
|
960
1110
|
key: "pay",
|
|
961
1111
|
value: function () {
|
|
962
|
-
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
963
|
-
return _regeneratorRuntime().wrap(function
|
|
964
|
-
while (1) switch (
|
|
1112
|
+
var _pay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1113
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context23) {
|
|
1114
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
965
1115
|
case 0:
|
|
966
1116
|
case "end":
|
|
967
|
-
return
|
|
1117
|
+
return _context23.stop();
|
|
968
1118
|
}
|
|
969
|
-
},
|
|
1119
|
+
}, _callee22);
|
|
970
1120
|
}));
|
|
971
1121
|
function pay() {
|
|
972
1122
|
return _pay.apply(this, arguments);
|
|
@@ -976,14 +1126,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
976
1126
|
}, {
|
|
977
1127
|
key: "getPayInfo",
|
|
978
1128
|
value: function () {
|
|
979
|
-
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
980
|
-
return _regeneratorRuntime().wrap(function
|
|
981
|
-
while (1) switch (
|
|
1129
|
+
var _getPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1130
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context24) {
|
|
1131
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
982
1132
|
case 0:
|
|
983
1133
|
case "end":
|
|
984
|
-
return
|
|
1134
|
+
return _context24.stop();
|
|
985
1135
|
}
|
|
986
|
-
},
|
|
1136
|
+
}, _callee23);
|
|
987
1137
|
}));
|
|
988
1138
|
function getPayInfo() {
|
|
989
1139
|
return _getPayInfo.apply(this, arguments);
|
|
@@ -993,15 +1143,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
993
1143
|
}, {
|
|
994
1144
|
key: "setOtherParams",
|
|
995
1145
|
value: function () {
|
|
996
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1146
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
997
1147
|
var _ref6,
|
|
998
1148
|
_ref6$cover,
|
|
999
1149
|
cover,
|
|
1000
|
-
|
|
1001
|
-
return _regeneratorRuntime().wrap(function
|
|
1002
|
-
while (1) switch (
|
|
1150
|
+
_args25 = arguments;
|
|
1151
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context25) {
|
|
1152
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1003
1153
|
case 0:
|
|
1004
|
-
_ref6 =
|
|
1154
|
+
_ref6 = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {}, _ref6$cover = _ref6.cover, cover = _ref6$cover === void 0 ? false : _ref6$cover;
|
|
1005
1155
|
if (cover) {
|
|
1006
1156
|
this.otherParams = params;
|
|
1007
1157
|
} else {
|
|
@@ -1009,11 +1159,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1009
1159
|
}
|
|
1010
1160
|
case 2:
|
|
1011
1161
|
case "end":
|
|
1012
|
-
return
|
|
1162
|
+
return _context25.stop();
|
|
1013
1163
|
}
|
|
1014
|
-
},
|
|
1164
|
+
}, _callee24, this);
|
|
1015
1165
|
}));
|
|
1016
|
-
function setOtherParams(
|
|
1166
|
+
function setOtherParams(_x18) {
|
|
1017
1167
|
return _setOtherParams.apply(this, arguments);
|
|
1018
1168
|
}
|
|
1019
1169
|
return setOtherParams;
|
|
@@ -1021,16 +1171,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1021
1171
|
}, {
|
|
1022
1172
|
key: "getOtherParams",
|
|
1023
1173
|
value: function () {
|
|
1024
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1025
|
-
return _regeneratorRuntime().wrap(function
|
|
1026
|
-
while (1) switch (
|
|
1174
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1175
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
1176
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1027
1177
|
case 0:
|
|
1028
|
-
return
|
|
1178
|
+
return _context26.abrupt("return", this.otherParams);
|
|
1029
1179
|
case 1:
|
|
1030
1180
|
case "end":
|
|
1031
|
-
return
|
|
1181
|
+
return _context26.stop();
|
|
1032
1182
|
}
|
|
1033
|
-
},
|
|
1183
|
+
}, _callee25, this);
|
|
1034
1184
|
}));
|
|
1035
1185
|
function getOtherParams() {
|
|
1036
1186
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1040,7 +1190,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1040
1190
|
}, {
|
|
1041
1191
|
key: "updateCart",
|
|
1042
1192
|
value: function updateCart(params) {
|
|
1043
|
-
var
|
|
1193
|
+
var _this6 = this;
|
|
1044
1194
|
var targetCartItem = this.store.cart.getItem(params._id);
|
|
1045
1195
|
if (!targetCartItem) {
|
|
1046
1196
|
throw new Error("\u6CA1\u6709\u627E\u5230".concat(params._id, "\u8D2D\u7269\u8F66\u5546\u54C1"));
|
|
@@ -1129,7 +1279,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1129
1279
|
var end_time = item.end_time;
|
|
1130
1280
|
var start_date = item.start_date;
|
|
1131
1281
|
var end_date = item.end_date;
|
|
1132
|
-
|
|
1282
|
+
_this6.store.cart.updateItem({
|
|
1133
1283
|
_id: item._id,
|
|
1134
1284
|
resources: resources,
|
|
1135
1285
|
date: {
|
|
@@ -1138,7 +1288,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1138
1288
|
}
|
|
1139
1289
|
});
|
|
1140
1290
|
} else {
|
|
1141
|
-
|
|
1291
|
+
_this6.store.cart.updateItem({
|
|
1142
1292
|
_id: item._id,
|
|
1143
1293
|
resources: resources
|
|
1144
1294
|
});
|
|
@@ -1175,10 +1325,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1175
1325
|
}, {
|
|
1176
1326
|
key: "batchUpdateCart",
|
|
1177
1327
|
value: function batchUpdateCart(paramsList) {
|
|
1178
|
-
var
|
|
1328
|
+
var _this7 = this;
|
|
1179
1329
|
var cartItems = [];
|
|
1180
1330
|
paramsList.forEach(function (params) {
|
|
1181
|
-
var cartItem =
|
|
1331
|
+
var cartItem = _this7.store.cart.formatCartItem(params);
|
|
1182
1332
|
cartItems.push(cartItem);
|
|
1183
1333
|
});
|
|
1184
1334
|
this.store.cart.batchSetItems(cartItems);
|
|
@@ -1206,11 +1356,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1206
1356
|
}, {
|
|
1207
1357
|
key: "checkCartItems",
|
|
1208
1358
|
value: function checkCartItems(type) {
|
|
1209
|
-
var
|
|
1359
|
+
var _this8 = this;
|
|
1210
1360
|
var cartItems = this.store.cart.getItems();
|
|
1211
1361
|
var errorCartItemIds = [];
|
|
1212
1362
|
cartItems.forEach(function (cartItem) {
|
|
1213
|
-
var result =
|
|
1363
|
+
var result = _this8.store.cart.checkCartItemByType(cartItem, type);
|
|
1214
1364
|
if (!result) {
|
|
1215
1365
|
errorCartItemIds.push(cartItem._id);
|
|
1216
1366
|
}
|
|
@@ -1638,11 +1788,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1638
1788
|
// .format("HH:mm");
|
|
1639
1789
|
// 根据 start_time 和 end_time 去匹配资源
|
|
1640
1790
|
var targetResource = null;
|
|
1641
|
-
var
|
|
1642
|
-
|
|
1791
|
+
var _iterator3 = _createForOfIteratorHelper(resources),
|
|
1792
|
+
_step3;
|
|
1643
1793
|
try {
|
|
1644
|
-
var
|
|
1645
|
-
var n =
|
|
1794
|
+
var _loop2 = function _loop2() {
|
|
1795
|
+
var n = _step3.value;
|
|
1646
1796
|
// 如果资源是独占的,并且 countMap 里选择过这个资源,则直接跳过
|
|
1647
1797
|
// if (n.resourceType === 'single' && countMap[n.id]) {
|
|
1648
1798
|
// resourcesUseableMap[n.id] = false;
|
|
@@ -1681,15 +1831,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1681
1831
|
}
|
|
1682
1832
|
},
|
|
1683
1833
|
_ret;
|
|
1684
|
-
for (
|
|
1685
|
-
_ret =
|
|
1834
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1835
|
+
_ret = _loop2();
|
|
1686
1836
|
if (_ret === 0) continue;
|
|
1687
1837
|
if (_ret === 1) break;
|
|
1688
1838
|
}
|
|
1689
1839
|
} catch (err) {
|
|
1690
|
-
|
|
1840
|
+
_iterator3.e(err);
|
|
1691
1841
|
} finally {
|
|
1692
|
-
|
|
1842
|
+
_iterator3.f();
|
|
1693
1843
|
}
|
|
1694
1844
|
return {
|
|
1695
1845
|
selectedResource: targetResource
|
|
@@ -1724,7 +1874,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1724
1874
|
key: "autoSelectAllProductResources",
|
|
1725
1875
|
value: function autoSelectAllProductResources(resources_code, timeSlots) {
|
|
1726
1876
|
var _dateRange$4,
|
|
1727
|
-
|
|
1877
|
+
_this9 = this;
|
|
1728
1878
|
var dateRange = this.store.date.getDateRange();
|
|
1729
1879
|
var resources = [];
|
|
1730
1880
|
if (dateRange !== null && dateRange !== void 0 && (_dateRange$4 = dateRange[0]) !== null && _dateRange$4 !== void 0 && _dateRange$4.date) {
|
|
@@ -1781,7 +1931,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1781
1931
|
};
|
|
1782
1932
|
}
|
|
1783
1933
|
// 如果传递了 timeSlots,代表是第二种资源,则直接拿 timeSlots 去匹配
|
|
1784
|
-
var res =
|
|
1934
|
+
var res = _this9.autoSelectAccountResources({
|
|
1785
1935
|
cartItem: item,
|
|
1786
1936
|
holder_id: item.holder_id,
|
|
1787
1937
|
resources_code: resources_code,
|
|
@@ -1801,7 +1951,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1801
1951
|
}
|
|
1802
1952
|
res.selectedResource.capacity = currentCapacity;
|
|
1803
1953
|
checkSubResourcesCapacity(res.selectedResource);
|
|
1804
|
-
|
|
1954
|
+
_this9.store.cart.updateItem({
|
|
1805
1955
|
_id: item._id,
|
|
1806
1956
|
// 这里要做去重,避免出现同样类型的资源被塞进同一个商品
|
|
1807
1957
|
resources: [].concat(_toConsumableArray((item._origin.resources || []).filter(function (existingRes) {
|
|
@@ -1816,7 +1966,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1816
1966
|
} else {
|
|
1817
1967
|
var _item$_productOrigin10, _productResources$fin;
|
|
1818
1968
|
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
1819
|
-
var allCartItems = cloneDeep(
|
|
1969
|
+
var allCartItems = cloneDeep(_this9.store.cart.getItems());
|
|
1820
1970
|
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
1821
1971
|
var selectedResources = [];
|
|
1822
1972
|
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 +2025,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1875
2025
|
} else {
|
|
1876
2026
|
selectResourcesMap[targetResource.id] += currentCapacity;
|
|
1877
2027
|
}
|
|
1878
|
-
|
|
2028
|
+
_this9.store.cart.updateItem({
|
|
1879
2029
|
_id: item._id,
|
|
1880
2030
|
resources: [].concat(_toConsumableArray((item._origin.resources || []).filter(function (existingRes) {
|
|
1881
2031
|
return existingRes.resourceType !== targetRenderList[0].resourceType;
|
|
@@ -1893,7 +2043,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1893
2043
|
// 如果购物车里没有 holderid数据,证明不按 holder 类流程预约走,给所有购物车一次性分派即可,不做账号下资源互斥逻辑
|
|
1894
2044
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].holder_id) {
|
|
1895
2045
|
accountList.forEach(function (account) {
|
|
1896
|
-
var cartItems =
|
|
2046
|
+
var cartItems = _this9.store.cart.getCartByAccount(account.getId());
|
|
1897
2047
|
selectForCartResources(cartItems);
|
|
1898
2048
|
});
|
|
1899
2049
|
} else {
|
|
@@ -1908,9 +2058,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1908
2058
|
key: "getTimeSlotByAllResources",
|
|
1909
2059
|
value: function getTimeSlotByAllResources(resources_code) {
|
|
1910
2060
|
var _dateRange,
|
|
1911
|
-
|
|
1912
|
-
_cartItems
|
|
1913
|
-
_cartItems$
|
|
2061
|
+
_this10 = this,
|
|
2062
|
+
_cartItems$3,
|
|
2063
|
+
_cartItems$4;
|
|
1914
2064
|
var dateRange = this.store.date.getDateRange();
|
|
1915
2065
|
// 取出购物车中所有一已选择的第一步资源
|
|
1916
2066
|
var resources = [];
|
|
@@ -1973,7 +2123,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1973
2123
|
};
|
|
1974
2124
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].holder_id) {
|
|
1975
2125
|
accountList.forEach(function (account) {
|
|
1976
|
-
var cartItems =
|
|
2126
|
+
var cartItems = _this10.store.cart.getCartByAccount(account.getId());
|
|
1977
2127
|
checkDuration(cartItems);
|
|
1978
2128
|
});
|
|
1979
2129
|
} else {
|
|
@@ -1981,18 +2131,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1981
2131
|
}
|
|
1982
2132
|
// 如果 cartItem 上既没有时间,也没有资源,认为外部属于异常调用,直接丢一个空数组出去
|
|
1983
2133
|
// 同时 session 类商品的流程也不应该调用这个方法
|
|
1984
|
-
if (!(cartItems !== null && cartItems !== void 0 && (_cartItems$ = cartItems[0]) !== null && _cartItems$ !== void 0 && _cartItems
|
|
2134
|
+
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
2135
|
return [];
|
|
1986
2136
|
}
|
|
1987
2137
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].start_date && !dateRange) {
|
|
1988
|
-
var _cartItems$
|
|
2138
|
+
var _cartItems$5, _cartItems$6;
|
|
1989
2139
|
dateRange = [{
|
|
1990
2140
|
date: cartItems === null || cartItems === void 0 ? void 0 : cartItems[0].start_date,
|
|
1991
2141
|
status: 'available',
|
|
1992
2142
|
week: '',
|
|
1993
2143
|
weekNum: 0
|
|
1994
2144
|
}, {
|
|
1995
|
-
date: (cartItems === null || cartItems === void 0 || (_cartItems$
|
|
2145
|
+
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
2146
|
status: 'available',
|
|
1997
2147
|
week: '',
|
|
1998
2148
|
weekNum: 0
|
|
@@ -2014,7 +2164,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2014
2164
|
}, {
|
|
2015
2165
|
key: "submitTimeSlot",
|
|
2016
2166
|
value: function submitTimeSlot(timeSlots) {
|
|
2017
|
-
var
|
|
2167
|
+
var _this11 = this;
|
|
2018
2168
|
// 以账号为维度处理数据。购物车里每一项的 startTime应该是前一个商品的 endTime,如果是第一个商品则用 timeSlots.start_at
|
|
2019
2169
|
var cartItems = cloneDeep(this.store.cart.getItems());
|
|
2020
2170
|
|
|
@@ -2040,7 +2190,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2040
2190
|
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
2191
|
delete resource.times;
|
|
2042
2192
|
});
|
|
2043
|
-
|
|
2193
|
+
_this11.store.cart.updateItem({
|
|
2044
2194
|
_id: item._id,
|
|
2045
2195
|
resources: newResources
|
|
2046
2196
|
});
|
|
@@ -2088,15 +2238,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2088
2238
|
}, {
|
|
2089
2239
|
key: "openProductDetail",
|
|
2090
2240
|
value: function () {
|
|
2091
|
-
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2241
|
+
var _openProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(productId) {
|
|
2092
2242
|
var targetProduct, targetProductData, newScheduleArr;
|
|
2093
|
-
return _regeneratorRuntime().wrap(function
|
|
2094
|
-
while (1) switch (
|
|
2243
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2244
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2095
2245
|
case 0:
|
|
2096
|
-
|
|
2246
|
+
_context27.next = 2;
|
|
2097
2247
|
return this.store.products.getProduct(productId);
|
|
2098
2248
|
case 2:
|
|
2099
|
-
targetProduct =
|
|
2249
|
+
targetProduct = _context27.sent;
|
|
2100
2250
|
if (targetProduct) {
|
|
2101
2251
|
targetProductData = targetProduct.getData();
|
|
2102
2252
|
this.store.currentProduct = targetProduct;
|
|
@@ -2105,11 +2255,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2105
2255
|
}
|
|
2106
2256
|
case 4:
|
|
2107
2257
|
case "end":
|
|
2108
|
-
return
|
|
2258
|
+
return _context27.stop();
|
|
2109
2259
|
}
|
|
2110
|
-
},
|
|
2260
|
+
}, _callee26, this);
|
|
2111
2261
|
}));
|
|
2112
|
-
function openProductDetail(
|
|
2262
|
+
function openProductDetail(_x19) {
|
|
2113
2263
|
return _openProductDetail.apply(this, arguments);
|
|
2114
2264
|
}
|
|
2115
2265
|
return openProductDetail;
|
|
@@ -2227,7 +2377,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2227
2377
|
}, {
|
|
2228
2378
|
key: "addProductToCart",
|
|
2229
2379
|
value: function addProductToCart(_ref13) {
|
|
2230
|
-
var
|
|
2380
|
+
var _this12 = this;
|
|
2231
2381
|
var product = _ref13.product,
|
|
2232
2382
|
date = _ref13.date,
|
|
2233
2383
|
account = _ref13.account;
|
|
@@ -2260,7 +2410,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2260
2410
|
});
|
|
2261
2411
|
if (cartItemsByDate.length) {
|
|
2262
2412
|
cartItemsByDate.forEach(function (n) {
|
|
2263
|
-
|
|
2413
|
+
_this12.store.cart.removeItem(n._id);
|
|
2264
2414
|
});
|
|
2265
2415
|
}
|
|
2266
2416
|
}
|
|
@@ -2286,29 +2436,29 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2286
2436
|
}, {
|
|
2287
2437
|
key: "getProductTypeById",
|
|
2288
2438
|
value: function () {
|
|
2289
|
-
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2439
|
+
var _getProductTypeById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(id) {
|
|
2290
2440
|
var product;
|
|
2291
|
-
return _regeneratorRuntime().wrap(function
|
|
2292
|
-
while (1) switch (
|
|
2441
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
2442
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2293
2443
|
case 0:
|
|
2294
|
-
|
|
2444
|
+
_context28.next = 2;
|
|
2295
2445
|
return this.store.products.getProduct(id);
|
|
2296
2446
|
case 2:
|
|
2297
|
-
product =
|
|
2447
|
+
product = _context28.sent;
|
|
2298
2448
|
if (!product) {
|
|
2299
|
-
|
|
2449
|
+
_context28.next = 5;
|
|
2300
2450
|
break;
|
|
2301
2451
|
}
|
|
2302
|
-
return
|
|
2452
|
+
return _context28.abrupt("return", product.getProductType());
|
|
2303
2453
|
case 5:
|
|
2304
|
-
return
|
|
2454
|
+
return _context28.abrupt("return", 'normal');
|
|
2305
2455
|
case 6:
|
|
2306
2456
|
case "end":
|
|
2307
|
-
return
|
|
2457
|
+
return _context28.stop();
|
|
2308
2458
|
}
|
|
2309
|
-
},
|
|
2459
|
+
}, _callee27, this);
|
|
2310
2460
|
}));
|
|
2311
|
-
function getProductTypeById(
|
|
2461
|
+
function getProductTypeById(_x20) {
|
|
2312
2462
|
return _getProductTypeById.apply(this, arguments);
|
|
2313
2463
|
}
|
|
2314
2464
|
return getProductTypeById;
|