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