@pisell/pisellos 2.1.76 → 2.1.78
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/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +16 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +23 -7
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +7 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +9 -7
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -37,5 +37,5 @@ export declare class DateModule extends BaseModule implements Module, DateModule
|
|
|
37
37
|
getResourceAvailableTimeList(params: IGetAvailableTimeListParams): Promise<ITime[]>;
|
|
38
38
|
clearDateRange(): void;
|
|
39
39
|
storeChange(): void;
|
|
40
|
-
getResourcesListByDate(date: string): any[]
|
|
40
|
+
getResourcesListByDate(date: string): any[];
|
|
41
41
|
}
|
|
@@ -85,6 +85,14 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
85
85
|
}, {
|
|
86
86
|
key: "setDateRange",
|
|
87
87
|
value: function setDateRange(dateRange) {
|
|
88
|
+
var _this2 = this;
|
|
89
|
+
// 如果 dateRange 传入的日期里没有 resource,但是本地有的,要尝试补充下
|
|
90
|
+
dateRange.forEach(function (item) {
|
|
91
|
+
var _item$resource;
|
|
92
|
+
if (!((_item$resource = item.resource) !== null && _item$resource !== void 0 && _item$resource.length)) {
|
|
93
|
+
item.resource = _this2.getResourcesListByDate(item.date);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
88
96
|
this.store.dateRange = dateRange;
|
|
89
97
|
}
|
|
90
98
|
}, {
|
|
@@ -157,10 +165,10 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
157
165
|
return n.date === item.date;
|
|
158
166
|
});
|
|
159
167
|
if (currentItemIndex !== -1) {
|
|
160
|
-
var _item$
|
|
168
|
+
var _item$resource2, _currentItem$resource3;
|
|
161
169
|
var currentItem = currentDateList[currentItemIndex];
|
|
162
170
|
// 看那一天的数据有没有相同的,把不同的资源合并进去即可
|
|
163
|
-
var newResource = (_item$
|
|
171
|
+
var newResource = (_item$resource2 = item.resource) === null || _item$resource2 === void 0 ? void 0 : _item$resource2.filter(function (n) {
|
|
164
172
|
var _currentItem$resource2;
|
|
165
173
|
return !((_currentItem$resource2 = currentItem.resource) !== null && _currentItem$resource2 !== void 0 && _currentItem$resource2.some(function (m) {
|
|
166
174
|
return m.id === n.id;
|
|
@@ -168,8 +176,8 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
176
|
});
|
|
169
177
|
// 如果有相同的资源,则使用 item 中的新的resource.times,而不是 currentItem 中的
|
|
170
178
|
(_currentItem$resource3 = currentItem.resource) === null || _currentItem$resource3 === void 0 || _currentItem$resource3.forEach(function (n) {
|
|
171
|
-
var _item$
|
|
172
|
-
var newResource = (_item$
|
|
179
|
+
var _item$resource3;
|
|
180
|
+
var newResource = (_item$resource3 = item.resource) === null || _item$resource3 === void 0 ? void 0 : _item$resource3.find(function (m) {
|
|
173
181
|
return m.id === n.id;
|
|
174
182
|
});
|
|
175
183
|
if (newResource) {
|
|
@@ -261,7 +269,7 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
261
269
|
}, {
|
|
262
270
|
key: "correctResourceTimeSlots",
|
|
263
271
|
value: function correctResourceTimeSlots(resourcesData) {
|
|
264
|
-
var
|
|
272
|
+
var _this3 = this;
|
|
265
273
|
return resourcesData.map(function (resource) {
|
|
266
274
|
// 检查资源是否有 times 数组和 start_time
|
|
267
275
|
if (!resource.times || !Array.isArray(resource.times) || !resource.start_time) {
|
|
@@ -284,7 +292,7 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
284
292
|
// 如果 start_at 早于资源的 start_time,需要修正
|
|
285
293
|
if (startAt.isBefore(resourceStartTime)) {
|
|
286
294
|
// 将 start_time 向上取整到下一个10分钟整数
|
|
287
|
-
var roundedStartTime =
|
|
295
|
+
var roundedStartTime = _this3.roundUpToNext10Minutes(resourceStartTime);
|
|
288
296
|
var roundedStartTimeDayjs = dayjs(roundedStartTime);
|
|
289
297
|
console.log("[DateModule] \u4FEE\u6B63\u65F6\u95F4\u6BB5\u5F00\u59CB\u65F6\u95F4: ".concat(timeSlot.start_at, " -> ").concat(roundedStartTime, " (\u8D44\u6E90ID: ").concat(resource.id, ", \u539F\u59CBstart_time: ").concat(resource.start_time, ")"));
|
|
290
298
|
|
|
@@ -393,9 +401,9 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
393
401
|
value: function getResourcesListByDate(date) {
|
|
394
402
|
var _dateList$find;
|
|
395
403
|
var dateList = this.store.dateList;
|
|
396
|
-
var resourcesList = (_dateList$find = dateList.find(function (item) {
|
|
404
|
+
var resourcesList = (dateList === null || dateList === void 0 || (_dateList$find = dateList.find(function (item) {
|
|
397
405
|
return item.date === date;
|
|
398
|
-
})) === null || _dateList$find === void 0 ? void 0 : _dateList$find.resource;
|
|
406
|
+
})) === null || _dateList$find === void 0 ? void 0 : _dateList$find.resource) || [];
|
|
399
407
|
return resourcesList;
|
|
400
408
|
}
|
|
401
409
|
}]);
|
|
@@ -354,7 +354,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
354
354
|
};
|
|
355
355
|
setOtherData(key: string, value: any): void;
|
|
356
356
|
getOtherData(key: string): any;
|
|
357
|
-
getProductTypeById(id: number): Promise<"
|
|
357
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
358
358
|
/**
|
|
359
359
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
360
360
|
*
|
|
@@ -2135,6 +2135,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2135
2135
|
}
|
|
2136
2136
|
});
|
|
2137
2137
|
}
|
|
2138
|
+
|
|
2139
|
+
// 如果依然 resources 空的,则证明他是切换日期了,此时直接从 date 模块里取
|
|
2140
|
+
if (resources.length === 0) {
|
|
2141
|
+
resources.push.apply(resources, _toConsumableArray(this.store.date.getResourcesListByDate(dateRange[0].date) || []));
|
|
2142
|
+
}
|
|
2138
2143
|
var resourcesMap = getResourcesMap(resources);
|
|
2139
2144
|
var duration = 0;
|
|
2140
2145
|
// duration = 不同账号的最长时间
|
|
@@ -2214,12 +2219,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2214
2219
|
var _item$_resourceOrigin;
|
|
2215
2220
|
return ((_item$_resourceOrigin = item._resourceOrigin) === null || _item$_resourceOrigin === void 0 ? void 0 : _item$_resourceOrigin[0].id) === firstResource;
|
|
2216
2221
|
}).length;
|
|
2217
|
-
if (sameResourceLength
|
|
2222
|
+
if (sameResourceLength === items.length) {
|
|
2218
2223
|
return 1;
|
|
2219
2224
|
}
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2225
|
+
// 找出单个购物车里最大的需求 capacity 即可
|
|
2226
|
+
return Math.max.apply(Math, _toConsumableArray(items.map(function (item) {
|
|
2227
|
+
return getCapacityInfoByCartItem(item).currentCapacity || 1;
|
|
2228
|
+
})));
|
|
2229
|
+
// return items.reduce((total, item) => {
|
|
2230
|
+
// return total + (getCapacityInfoByCartItem(item).currentCapacity || 0);
|
|
2231
|
+
// }, 0);
|
|
2223
2232
|
};
|
|
2224
2233
|
|
|
2225
2234
|
// 如果是多个人预约,去要求出几个 holder 下最大的商品需求容量capacity
|
|
@@ -2387,9 +2396,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2387
2396
|
if (sameResourceLength !== items.length) {
|
|
2388
2397
|
return 1;
|
|
2389
2398
|
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2399
|
+
// 找出单个购物车里最大的需求 capacity 即可
|
|
2400
|
+
return Math.max.apply(Math, _toConsumableArray(items.map(function (item) {
|
|
2401
|
+
return getCapacityInfoByCartItem(item).currentCapacity || 1;
|
|
2402
|
+
})));
|
|
2393
2403
|
}; // 如果是多个预约,去要求出几个 holder 下最大的需求容量capacity
|
|
2394
2404
|
maxCapacity = 1;
|
|
2395
2405
|
if (cartItems !== null && cartItems !== void 0 && cartItems[0].holder_id) {
|
|
@@ -3152,6 +3162,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3152
3162
|
itemsByResourceType[resourceCode] = [];
|
|
3153
3163
|
}
|
|
3154
3164
|
// 避免重复添加同一个商品
|
|
3165
|
+
// 如果之前添加过的依赖相同资源的跟我现在是同一个 holder,也不需要重复添加
|
|
3166
|
+
if (itemsByResourceType[resourceCode].find(function (item) {
|
|
3167
|
+
return item.holder_id === cartItem.holder_id;
|
|
3168
|
+
})) {
|
|
3169
|
+
return;
|
|
3170
|
+
}
|
|
3155
3171
|
if (!itemsByResourceType[resourceCode].find(function (item) {
|
|
3156
3172
|
return item._id === cartItem._id;
|
|
3157
3173
|
})) {
|
|
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
115
115
|
* 获取当前的客户搜索条件
|
|
116
116
|
* @returns 当前搜索条件
|
|
117
117
|
*/
|
|
118
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
118
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
119
119
|
/**
|
|
120
120
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
121
121
|
* @returns 客户状态
|
|
@@ -37,5 +37,5 @@ export declare class DateModule extends BaseModule implements Module, DateModule
|
|
|
37
37
|
getResourceAvailableTimeList(params: IGetAvailableTimeListParams): Promise<ITime[]>;
|
|
38
38
|
clearDateRange(): void;
|
|
39
39
|
storeChange(): void;
|
|
40
|
-
getResourcesListByDate(date: string): any[]
|
|
40
|
+
getResourcesListByDate(date: string): any[];
|
|
41
41
|
}
|
|
@@ -64,6 +64,12 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
setDateRange(dateRange) {
|
|
67
|
+
dateRange.forEach((item) => {
|
|
68
|
+
var _a;
|
|
69
|
+
if (!((_a = item.resource) == null ? void 0 : _a.length)) {
|
|
70
|
+
item.resource = this.getResourcesListByDate(item.date);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
67
73
|
this.store.dateRange = dateRange;
|
|
68
74
|
}
|
|
69
75
|
getDateRange() {
|
|
@@ -252,7 +258,7 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
252
258
|
getResourcesListByDate(date) {
|
|
253
259
|
var _a;
|
|
254
260
|
const dateList = this.store.dateList;
|
|
255
|
-
const resourcesList = (_a = dateList.find((item) => item.date === date)) == null ? void 0 : _a.resource;
|
|
261
|
+
const resourcesList = ((_a = dateList == null ? void 0 : dateList.find((item) => item.date === date)) == null ? void 0 : _a.resource) || [];
|
|
256
262
|
return resourcesList;
|
|
257
263
|
}
|
|
258
264
|
};
|
|
@@ -354,7 +354,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
354
354
|
};
|
|
355
355
|
setOtherData(key: string, value: any): void;
|
|
356
356
|
getOtherData(key: string): any;
|
|
357
|
-
getProductTypeById(id: number): Promise<"
|
|
357
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
358
358
|
/**
|
|
359
359
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
360
360
|
*
|
|
@@ -1461,6 +1461,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
});
|
|
1463
1463
|
}
|
|
1464
|
+
if (resources.length === 0) {
|
|
1465
|
+
resources.push(...this.store.date.getResourcesListByDate(dateRange[0].date) || []);
|
|
1466
|
+
}
|
|
1464
1467
|
const resourcesMap = (0, import_utils2.getResourcesMap)(resources);
|
|
1465
1468
|
let duration = 0;
|
|
1466
1469
|
const accountList = this.store.accountList.getAccounts();
|
|
@@ -1535,12 +1538,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1535
1538
|
var _a3;
|
|
1536
1539
|
return ((_a3 = item._resourceOrigin) == null ? void 0 : _a3[0].id) === firstResource;
|
|
1537
1540
|
}).length;
|
|
1538
|
-
if (sameResourceLength
|
|
1541
|
+
if (sameResourceLength === items.length) {
|
|
1539
1542
|
return 1;
|
|
1540
1543
|
}
|
|
1541
|
-
return items.
|
|
1542
|
-
return total + ((0, import_capacity.getCapacityInfoByCartItem)(item).currentCapacity || 0);
|
|
1543
|
-
}, 0);
|
|
1544
|
+
return Math.max(...items.map((item) => (0, import_capacity.getCapacityInfoByCartItem)(item).currentCapacity || 1));
|
|
1544
1545
|
};
|
|
1545
1546
|
let maxCapacity = 1;
|
|
1546
1547
|
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
@@ -1673,9 +1674,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1673
1674
|
if (sameResourceLength !== items.length) {
|
|
1674
1675
|
return 1;
|
|
1675
1676
|
}
|
|
1676
|
-
return items.
|
|
1677
|
-
return total + ((0, import_capacity.getCapacityInfoByCartItem)(item).currentCapacity || 0);
|
|
1678
|
-
}, 0);
|
|
1677
|
+
return Math.max(...items.map((item) => (0, import_capacity.getCapacityInfoByCartItem)(item).currentCapacity || 1));
|
|
1679
1678
|
};
|
|
1680
1679
|
let maxCapacity = 1;
|
|
1681
1680
|
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
@@ -2264,6 +2263,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2264
2263
|
if (!itemsByResourceType[resourceCode]) {
|
|
2265
2264
|
itemsByResourceType[resourceCode] = [];
|
|
2266
2265
|
}
|
|
2266
|
+
if (itemsByResourceType[resourceCode].find((item) => item.holder_id === cartItem.holder_id)) {
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2267
2269
|
if (!itemsByResourceType[resourceCode].find((item) => item._id === cartItem._id)) {
|
|
2268
2270
|
itemsByResourceType[resourceCode].push(cartItem);
|
|
2269
2271
|
}
|
|
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
115
115
|
* 获取当前的客户搜索条件
|
|
116
116
|
* @returns 当前搜索条件
|
|
117
117
|
*/
|
|
118
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
118
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
119
119
|
/**
|
|
120
120
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
121
121
|
* @returns 客户状态
|