@pisell/pisellos 0.0.97 → 0.0.98
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.
|
@@ -203,8 +203,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
203
203
|
key: "loadProducts",
|
|
204
204
|
value: function () {
|
|
205
205
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
206
|
-
var _schedule_ids
|
|
207
|
-
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$schedule_ids, schedule_ids, schedule_date, schedule_ids_data, userPlugin, customer_id, productsData;
|
|
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, 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:
|
|
@@ -222,8 +222,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
userPlugin = this.core.getPlugin('user');
|
|
225
|
-
customer_id =
|
|
226
|
-
|
|
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;
|
|
227
233
|
return this.request.post("/product/query", {
|
|
228
234
|
open_quotation: 1,
|
|
229
235
|
open_bundle: 1,
|
|
@@ -242,11 +248,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
242
248
|
}, {
|
|
243
249
|
useCache: true
|
|
244
250
|
});
|
|
245
|
-
case
|
|
251
|
+
case 7:
|
|
246
252
|
productsData = _context2.sent;
|
|
247
253
|
this.store.products.addProduct(productsData.data.list);
|
|
248
254
|
return _context2.abrupt("return", productsData.data.list);
|
|
249
|
-
case
|
|
255
|
+
case 10:
|
|
250
256
|
case "end":
|
|
251
257
|
return _context2.stop();
|
|
252
258
|
}
|
|
@@ -309,34 +315,40 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
309
315
|
var _updateQuotationPriceAndCart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(date) {
|
|
310
316
|
var _this$otherParams3,
|
|
311
317
|
_this3 = this;
|
|
312
|
-
var dateRange,
|
|
318
|
+
var dateRange, scheduleList, scheduleIds, cartItems, _iterator, _step, _loop;
|
|
313
319
|
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
314
320
|
while (1) switch (_context5.prev = _context5.next) {
|
|
315
321
|
case 0:
|
|
316
322
|
dateRange = this.store.date.getDateRange();
|
|
323
|
+
scheduleList = this.store.schedule.getAvailabilityScheduleDateList() || [];
|
|
317
324
|
scheduleIds = [];
|
|
318
|
-
if (dateRange.length) {
|
|
319
|
-
scheduleList = this.store.schedule.getAvailabilityScheduleDateList();
|
|
325
|
+
if (dateRange && dateRange.length) {
|
|
320
326
|
scheduleIds = scheduleList.filter(function (n) {
|
|
321
327
|
return n.date === dateRange[0].date;
|
|
322
328
|
}).flatMap(function (n) {
|
|
323
329
|
return n.schedule_id;
|
|
324
330
|
});
|
|
331
|
+
} else {
|
|
332
|
+
scheduleIds = scheduleList.filter(function (n) {
|
|
333
|
+
return n.date === date;
|
|
334
|
+
}).flatMap(function (n) {
|
|
335
|
+
return n.schedule_id;
|
|
336
|
+
});
|
|
325
337
|
}
|
|
326
|
-
_context5.next =
|
|
338
|
+
_context5.next = 6;
|
|
327
339
|
return this.loadProducts(_objectSpread(_objectSpread({}, (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.productModuleParams), {}, {
|
|
328
340
|
scheduleIds: scheduleIds,
|
|
329
341
|
schedule_date: date
|
|
330
342
|
}));
|
|
331
|
-
case
|
|
343
|
+
case 6:
|
|
332
344
|
// 更新完商品数据以后,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
|
|
333
345
|
cartItems = this.store.cart.getItems();
|
|
334
346
|
if (!cartItems.length) {
|
|
335
|
-
_context5.next =
|
|
347
|
+
_context5.next = 25;
|
|
336
348
|
break;
|
|
337
349
|
}
|
|
338
350
|
_iterator = _createForOfIteratorHelper(cartItems);
|
|
339
|
-
_context5.prev =
|
|
351
|
+
_context5.prev = 9;
|
|
340
352
|
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
341
353
|
var _bundle;
|
|
342
354
|
var item, targetProduct, productInfo, bundle;
|
|
@@ -382,33 +394,33 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
382
394
|
}, _loop);
|
|
383
395
|
});
|
|
384
396
|
_iterator.s();
|
|
385
|
-
case
|
|
397
|
+
case 12:
|
|
386
398
|
if ((_step = _iterator.n()).done) {
|
|
387
|
-
_context5.next =
|
|
399
|
+
_context5.next = 16;
|
|
388
400
|
break;
|
|
389
401
|
}
|
|
390
|
-
return _context5.delegateYield(_loop(), "t0",
|
|
391
|
-
case
|
|
392
|
-
_context5.next =
|
|
402
|
+
return _context5.delegateYield(_loop(), "t0", 14);
|
|
403
|
+
case 14:
|
|
404
|
+
_context5.next = 12;
|
|
393
405
|
break;
|
|
394
|
-
case
|
|
395
|
-
_context5.next =
|
|
406
|
+
case 16:
|
|
407
|
+
_context5.next = 21;
|
|
396
408
|
break;
|
|
397
|
-
case
|
|
398
|
-
_context5.prev =
|
|
399
|
-
_context5.t1 = _context5["catch"](
|
|
409
|
+
case 18:
|
|
410
|
+
_context5.prev = 18;
|
|
411
|
+
_context5.t1 = _context5["catch"](9);
|
|
400
412
|
_iterator.e(_context5.t1);
|
|
401
|
-
case
|
|
402
|
-
_context5.prev =
|
|
413
|
+
case 21:
|
|
414
|
+
_context5.prev = 21;
|
|
403
415
|
_iterator.f();
|
|
404
|
-
return _context5.finish(
|
|
405
|
-
case 23:
|
|
406
|
-
;
|
|
416
|
+
return _context5.finish(21);
|
|
407
417
|
case 24:
|
|
418
|
+
;
|
|
419
|
+
case 25:
|
|
408
420
|
case "end":
|
|
409
421
|
return _context5.stop();
|
|
410
422
|
}
|
|
411
|
-
}, _callee4, this, [[
|
|
423
|
+
}, _callee4, this, [[9, 18, 21, 24]]);
|
|
412
424
|
}));
|
|
413
425
|
function updateQuotationPriceAndCart(_x5) {
|
|
414
426
|
return _updateQuotationPriceAndCart.apply(this, arguments);
|
|
@@ -171,7 +171,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
let userPlugin = this.core.getPlugin("user");
|
|
174
|
-
let customer_id =
|
|
174
|
+
let customer_id = void 0;
|
|
175
|
+
try {
|
|
176
|
+
customer_id = (_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id;
|
|
177
|
+
} catch (error) {
|
|
178
|
+
console.error(error);
|
|
179
|
+
}
|
|
175
180
|
const productsData = await this.request.post(
|
|
176
181
|
`/product/query`,
|
|
177
182
|
{
|
|
@@ -221,10 +226,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
221
226
|
async updateQuotationPriceAndCart(date) {
|
|
222
227
|
var _a;
|
|
223
228
|
const dateRange = this.store.date.getDateRange();
|
|
229
|
+
const scheduleList = this.store.schedule.getAvailabilityScheduleDateList() || [];
|
|
224
230
|
let scheduleIds = [];
|
|
225
|
-
if (dateRange.length) {
|
|
226
|
-
const scheduleList = this.store.schedule.getAvailabilityScheduleDateList();
|
|
231
|
+
if (dateRange && dateRange.length) {
|
|
227
232
|
scheduleIds = scheduleList.filter((n) => n.date === dateRange[0].date).flatMap((n) => n.schedule_id);
|
|
233
|
+
} else {
|
|
234
|
+
scheduleIds = scheduleList.filter((n) => n.date === date).flatMap((n) => n.schedule_id);
|
|
228
235
|
}
|
|
229
236
|
await this.loadProducts({
|
|
230
237
|
...(_a = this.otherParams) == null ? void 0 : _a.productModuleParams,
|