@pisell/pisellos 0.0.113 → 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.
- package/dist/modules/Schedule/types.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -3
- package/dist/solution/BookingByStep/index.js +40 -32
- package/lib/modules/Schedule/types.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -3
- package/lib/solution/BookingByStep/index.js +19 -19
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
|
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
|
|
216
|
-
// 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
217
|
-
if (!
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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
|
|
258
|
+
case 9:
|
|
260
259
|
case "end":
|
|
261
260
|
return _context2.stop();
|
|
262
261
|
}
|
|
@@ -271,7 +270,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
271
270
|
key: "loadProductByScheduleDate",
|
|
272
271
|
value: function () {
|
|
273
272
|
var _loadProductByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2) {
|
|
274
|
-
var
|
|
273
|
+
var _product_ids;
|
|
274
|
+
var date, _ref2$product_ids, product_ids, _ref2$category_ids, category_ids, scheduleList, _schedule$product_ids, schedule, otherProductsIds, allProductIds;
|
|
275
275
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
276
276
|
while (1) switch (_context3.prev = _context3.next) {
|
|
277
277
|
case 0:
|
|
@@ -288,23 +288,31 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
288
288
|
week: '',
|
|
289
289
|
weekNum: 0
|
|
290
290
|
}]);
|
|
291
|
-
scheduleIds = scheduleList
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
|
297
|
+
if (!((_product_ids = product_ids) !== null && _product_ids !== void 0 && _product_ids.length)) {
|
|
298
|
+
schedule = scheduleList.find(function (n) {
|
|
299
|
+
return n.date === date;
|
|
300
|
+
});
|
|
301
|
+
if (schedule && (_schedule$product_ids = schedule.product_ids) !== null && _schedule$product_ids !== void 0 && _schedule$product_ids.length) {
|
|
302
|
+
product_ids = schedule.product_ids;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
// 尝试去拿schedule 里的 other_product_ids 和 product_ids 拼在一起去重
|
|
298
306
|
otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
299
307
|
allProductIds = [].concat(_toConsumableArray(product_ids), _toConsumableArray(otherProductsIds)).filter(function (n, index, self) {
|
|
300
308
|
return self.indexOf(n) === index;
|
|
301
309
|
});
|
|
302
310
|
_context3.next = 8;
|
|
303
311
|
return this.loadProducts({
|
|
304
|
-
schedule_ids: scheduleIds,
|
|
312
|
+
// schedule_ids: scheduleIds,
|
|
305
313
|
product_ids: allProductIds,
|
|
306
|
-
category_ids: category_ids
|
|
307
|
-
schedule_date: date
|
|
314
|
+
category_ids: category_ids
|
|
315
|
+
// schedule_date: date,
|
|
308
316
|
});
|
|
309
317
|
case 8:
|
|
310
318
|
return _context3.abrupt("return", _context3.sent);
|
|
@@ -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,
|
|
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
|
);
|
|
@@ -215,19 +207,27 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
215
207
|
product_ids = [],
|
|
216
208
|
category_ids = []
|
|
217
209
|
}) {
|
|
210
|
+
var _a;
|
|
218
211
|
const scheduleList = this.store.schedule.getAvailabilityScheduleDateList();
|
|
219
212
|
this.setDateRange([
|
|
220
213
|
{ date, status: "available", week: "", weekNum: 0 },
|
|
221
214
|
{ date, status: "available", week: "", weekNum: 0 }
|
|
222
215
|
]);
|
|
223
|
-
|
|
216
|
+
if (!(product_ids == null ? void 0 : product_ids.length)) {
|
|
217
|
+
const schedule = scheduleList.find((n) => n.date === date);
|
|
218
|
+
if (schedule && ((_a = schedule.product_ids) == null ? void 0 : _a.length)) {
|
|
219
|
+
product_ids = schedule.product_ids;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
224
222
|
const otherProductsIds = this.store.schedule.getOtherProductsIds() || [];
|
|
225
|
-
const allProductIds = [...product_ids, ...otherProductsIds].filter(
|
|
223
|
+
const allProductIds = [...product_ids, ...otherProductsIds].filter(
|
|
224
|
+
(n, index, self) => self.indexOf(n) === index
|
|
225
|
+
);
|
|
226
226
|
return await this.loadProducts({
|
|
227
|
-
schedule_ids: scheduleIds,
|
|
227
|
+
// schedule_ids: scheduleIds,
|
|
228
228
|
product_ids: allProductIds,
|
|
229
|
-
category_ids
|
|
230
|
-
schedule_date: date
|
|
229
|
+
category_ids
|
|
230
|
+
// schedule_date: date,
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
233
|
async updateQuotationPriceAndCart(date) {
|