@pisell/pisellos 0.0.114 → 0.0.115

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.
@@ -42,12 +42,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
42
42
  * 更新step
43
43
  */
44
44
  updateStep(key: string, step: IStep): void;
45
- loadProducts({ category_ids, product_ids, collection, schedule_ids, schedule_date, }: {
45
+ loadProducts({ category_ids, product_ids, collection, }: {
46
46
  category_ids?: number[];
47
47
  product_ids?: number[];
48
48
  collection?: number | string[];
49
- schedule_ids?: number[];
50
- schedule_date?: string;
51
49
  }): Promise<any>;
52
50
  loadProductByScheduleDate({ date, product_ids, category_ids, }: {
53
51
  date: string;
@@ -207,24 +207,23 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
207
207
  key: "loadProducts",
208
208
  value: function () {
209
209
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
210
- var _schedule_ids;
211
- 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;
210
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, userPlugin, customer_id, _userPlugin$get, productsData;
212
211
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
213
212
  while (1) switch (_context2.prev = _context2.next) {
214
213
  case 0:
215
- _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$schedule_ids = _ref.schedule_ids, schedule_ids = _ref$schedule_ids === void 0 ? [] : _ref$schedule_ids, schedule_date = _ref.schedule_date;
216
- // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
217
- if (!((_schedule_ids = schedule_ids) !== null && _schedule_ids !== void 0 && _schedule_ids.length)) {
218
- schedule_ids_data = this.store.schedule.getScheduleListByIds(schedule_ids).map(function (n) {
219
- return n.id;
220
- });
221
- if (schedule_ids_data.length) {
222
- schedule_ids = schedule_ids_data;
223
- } else if (schedule_date) {
224
- // 后端说如果 schedule_ids 如果为空,需要给[0]
225
- schedule_ids = [0];
226
- }
227
- }
214
+ _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection;
215
+ // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
216
+ // if (!schedule_ids?.length) {
217
+ // const schedule_ids_data = this.store.schedule
218
+ // .getScheduleListByIds(schedule_ids)
219
+ // .map((n) => n.id);
220
+ // if (schedule_ids_data.length) {
221
+ // schedule_ids = schedule_ids_data;
222
+ // } else if (schedule_date) {
223
+ // // 后端说如果 schedule_ids 如果为空,需要给[0]
224
+ // schedule_ids = [0];
225
+ // }
226
+ // }
228
227
  userPlugin = this.core.getPlugin('user');
229
228
  customer_id = undefined;
230
229
  try {
@@ -233,7 +232,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
233
232
  console.error(error);
234
233
  }
235
234
  // 如果没传schedule_date,则从
236
- _context2.next = 7;
235
+ _context2.next = 6;
237
236
  return this.request.post("/product/query", {
238
237
  open_quotation: 1,
239
238
  open_bundle: 0,
@@ -246,17 +245,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
246
245
  category_ids: category_ids,
247
246
  ids: product_ids,
248
247
  collection: collection,
249
- front_end_cache_id: this.cacheId,
250
- client_schedule_ids: schedule_ids,
251
- schedule_date: schedule_date
248
+ front_end_cache_id: this.cacheId
249
+ // client_schedule_ids: schedule_ids,
250
+ // schedule_date,
252
251
  }, {
253
252
  useCache: true
254
253
  });
255
- case 7:
254
+ case 6:
256
255
  productsData = _context2.sent;
257
256
  this.store.products.addProduct(productsData.data.list);
258
257
  return _context2.abrupt("return", productsData.data.list);
259
- case 10:
258
+ case 9:
260
259
  case "end":
261
260
  return _context2.stop();
262
261
  }
@@ -272,7 +271,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
272
271
  value: function () {
273
272
  var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
274
273
  var _product_ids;
275
- var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, scheduleIds, _schedule$product_ids, schedule, otherProductsIds, allProductIds;
274
+ var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, _schedule$product_ids, schedule, otherProductsIds, allProductIds;
276
275
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
277
276
  while (1) switch (_context3.prev = _context3.next) {
278
277
  case 0:
@@ -289,13 +288,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
289
288
  week: '',
290
289
  weekNum: 0
291
290
  }]);
292
- scheduleIds = scheduleList.filter(function (n) {
293
- return n.date === date;
294
- }).flatMap(function (n) {
295
- return n.schedule_id;
296
- }).filter(function (n) {
297
- return n !== null && n !== undefined;
298
- }); // 如果外面没传 product_ids,尝试从对应 schedule 里拿 product_ids
291
+ // const scheduleIds = scheduleList
292
+ // .filter((n) => n.date === date)
293
+ // .flatMap((n) => n.schedule_id)
294
+ // .filter((n) => n !== null && n !== undefined);
295
+
296
+ // 如果外面没传 product_ids,尝试从对应 schedule 里拿 product_ids
299
297
  if (!((_product_ids = product_ids) !== null && _product_ids !== void 0 && _product_ids.length)) {
300
298
  schedule = scheduleList.find(function (n) {
301
299
  return n.date === date;
@@ -304,22 +302,21 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
304
302
  product_ids = schedule.product_ids;
305
303
  }
306
304
  }
307
-
308
305
  // 尝试去拿schedule 里的 other_product_ids 和 product_ids 拼在一起去重
309
306
  otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
310
307
  allProductIds = [].concat(_toConsumableArray(product_ids), _toConsumableArray(otherProductsIds)).filter(function (n, index, self) {
311
308
  return self.indexOf(n) === index;
312
309
  });
313
- _context3.next = 9;
310
+ _context3.next = 8;
314
311
  return this.loadProducts({
315
- schedule_ids: scheduleIds,
312
+ // schedule_ids: scheduleIds,
316
313
  product_ids: allProductIds,
317
- category_ids: category_ids,
318
- schedule_date: date
314
+ category_ids: category_ids
315
+ // schedule_date: date,
319
316
  });
320
- case 9:
317
+ case 8:
321
318
  return _context3.abrupt("return", _context3.sent);
322
- case 10:
319
+ case 9:
323
320
  case "end":
324
321
  return _context3.stop();
325
322
  }
@@ -42,12 +42,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
42
42
  * 更新step
43
43
  */
44
44
  updateStep(key: string, step: IStep): void;
45
- loadProducts({ category_ids, product_ids, collection, schedule_ids, schedule_date, }: {
45
+ loadProducts({ category_ids, product_ids, collection, }: {
46
46
  category_ids?: number[];
47
47
  product_ids?: number[];
48
48
  collection?: number | string[];
49
- schedule_ids?: number[];
50
- schedule_date?: string;
51
49
  }): Promise<any>;
52
50
  loadProductByScheduleDate({ date, product_ids, category_ids, }: {
53
51
  date: string;
@@ -161,19 +161,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
161
161
  async loadProducts({
162
162
  category_ids = [],
163
163
  product_ids = [],
164
- collection = [],
165
- schedule_ids = [],
166
- schedule_date
164
+ collection = []
165
+ // schedule_ids = [],
166
+ // schedule_date,
167
167
  }) {
168
168
  var _a;
169
- if (!(schedule_ids == null ? void 0 : schedule_ids.length)) {
170
- const schedule_ids_data = this.store.schedule.getScheduleListByIds(schedule_ids).map((n) => n.id);
171
- if (schedule_ids_data.length) {
172
- schedule_ids = schedule_ids_data;
173
- } else if (schedule_date) {
174
- schedule_ids = [0];
175
- }
176
- }
177
169
  let userPlugin = this.core.getPlugin("user");
178
170
  let customer_id = void 0;
179
171
  try {
@@ -201,9 +193,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
201
193
  category_ids,
202
194
  ids: product_ids,
203
195
  collection,
204
- front_end_cache_id: this.cacheId,
205
- client_schedule_ids: schedule_ids,
206
- schedule_date
196
+ front_end_cache_id: this.cacheId
197
+ // client_schedule_ids: schedule_ids,
198
+ // schedule_date,
207
199
  },
208
200
  { useCache: true }
209
201
  );
@@ -221,7 +213,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
221
213
  { date, status: "available", week: "", weekNum: 0 },
222
214
  { date, status: "available", week: "", weekNum: 0 }
223
215
  ]);
224
- const scheduleIds = scheduleList.filter((n) => n.date === date).flatMap((n) => n.schedule_id).filter((n) => n !== null && n !== void 0);
225
216
  if (!(product_ids == null ? void 0 : product_ids.length)) {
226
217
  const schedule = scheduleList.find((n) => n.date === date);
227
218
  if (schedule && ((_a = schedule.product_ids) == null ? void 0 : _a.length)) {
@@ -229,12 +220,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
229
220
  }
230
221
  }
231
222
  const otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
232
- const allProductIds = [...product_ids, ...otherProductsIds].filter((n, index, self) => self.indexOf(n) === index);
223
+ const allProductIds = [...product_ids, ...otherProductsIds].filter(
224
+ (n, index, self) => self.indexOf(n) === index
225
+ );
233
226
  return await this.loadProducts({
234
- schedule_ids: scheduleIds,
227
+ // schedule_ids: scheduleIds,
235
228
  product_ids: allProductIds,
236
- category_ids,
237
- schedule_date: date
229
+ category_ids
230
+ // schedule_date: date,
238
231
  });
239
232
  }
240
233
  async updateQuotationPriceAndCart(date) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.114",
4
+ "version": "0.0.115",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",