@pisell/pisellos 0.0.360 → 0.0.362
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/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +6 -0
- package/dist/solution/BookingByStep/index.js +302 -99
- package/dist/solution/BookingByStep/utils/capacity.js +1 -2
- package/dist/solution/RegisterAndLogin/config.js +6 -4
- package/dist/solution/RegisterAndLogin/index.js +78 -28
- package/dist/solution/RegisterAndLogin/types.d.ts +1 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +6 -0
- package/lib/solution/BookingByStep/index.js +161 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -2
- package/lib/solution/BookingTicket/index.js +6 -0
- package/lib/solution/RegisterAndLogin/config.js +6 -4
- package/lib/solution/RegisterAndLogin/index.js +47 -1
- package/lib/solution/RegisterAndLogin/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -344,8 +344,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
344
344
|
resourcesInType.forEach(function (resource) {
|
|
345
345
|
// 过滤出在时间段内的资源时间片
|
|
346
346
|
var availableTimes = resource.times.filter(function (time) {
|
|
347
|
-
|
|
348
|
-
return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute') && ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.length) === 0;
|
|
347
|
+
return !dayjs(time.start_at).isAfter(dayjs(timeSlotStart), 'minute') && !dayjs(time.end_at).isBefore(dayjs(timeSlotEnd), 'minute') || dayjs(time.start_at).isBefore(dayjs(timeSlotEnd), 'minute') && dayjs(time.end_at).isAfter(dayjs(timeSlotStart), 'minute');
|
|
349
348
|
});
|
|
350
349
|
if (availableTimes.length > 0) {
|
|
351
350
|
availableResourceCount++;
|
|
@@ -189,7 +189,8 @@ var onlineStoreConfig = {
|
|
|
189
189
|
return {
|
|
190
190
|
phone: String(params.phone),
|
|
191
191
|
code: params.code,
|
|
192
|
-
country_calling_code: String(params.country_calling_code)
|
|
192
|
+
country_calling_code: String(params.country_calling_code),
|
|
193
|
+
action: params.action
|
|
193
194
|
};
|
|
194
195
|
}
|
|
195
196
|
},
|
|
@@ -344,7 +345,7 @@ var onlineStoreConfig = {
|
|
|
344
345
|
method: 'POST',
|
|
345
346
|
transformParams: function transformParams(params) {
|
|
346
347
|
return {
|
|
347
|
-
|
|
348
|
+
code: params.code
|
|
348
349
|
};
|
|
349
350
|
}
|
|
350
351
|
}
|
|
@@ -511,7 +512,8 @@ var defaultConfig = {
|
|
|
511
512
|
return {
|
|
512
513
|
phone: String(params.phone),
|
|
513
514
|
code: params.code,
|
|
514
|
-
country_calling_code: String(params.country_calling_code)
|
|
515
|
+
country_calling_code: String(params.country_calling_code),
|
|
516
|
+
action: params.action
|
|
515
517
|
};
|
|
516
518
|
}
|
|
517
519
|
},
|
|
@@ -666,7 +668,7 @@ var defaultConfig = {
|
|
|
666
668
|
method: 'POST',
|
|
667
669
|
transformParams: function transformParams(params) {
|
|
668
670
|
return {
|
|
669
|
-
|
|
671
|
+
code: params.code
|
|
670
672
|
};
|
|
671
673
|
}
|
|
672
674
|
}
|
|
@@ -2250,44 +2250,63 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2250
2250
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2251
2251
|
while (1) switch (_context35.prev = _context35.next) {
|
|
2252
2252
|
case 0:
|
|
2253
|
-
|
|
2253
|
+
console.log('[RegisterAndLogin] Facebook 登录开始', {
|
|
2254
|
+
tokenLength: (token === null || token === void 0 ? void 0 : token.length) || 0,
|
|
2255
|
+
timestamp: Date.now()
|
|
2256
|
+
});
|
|
2257
|
+
_context35.next = 3;
|
|
2254
2258
|
return this.initFacebookSDK(token);
|
|
2255
|
-
case
|
|
2259
|
+
case 3:
|
|
2260
|
+
console.log('[RegisterAndLogin] Facebook SDK 初始化完成,准备调用 FB.login');
|
|
2256
2261
|
return _context35.abrupt("return", new Promise(function (resolve, reject) {
|
|
2262
|
+
console.log('[RegisterAndLogin] 调用 FB.login', {
|
|
2263
|
+
scope: 'email,public_profile'
|
|
2264
|
+
});
|
|
2257
2265
|
window.FB.login( /*#__PURE__*/function () {
|
|
2258
2266
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(response) {
|
|
2259
2267
|
var result;
|
|
2260
2268
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2261
2269
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2262
2270
|
case 0:
|
|
2271
|
+
console.log('[RegisterAndLogin] FB.login 回调触发', {
|
|
2272
|
+
hasAuthResponse: Boolean(response === null || response === void 0 ? void 0 : response.authResponse),
|
|
2273
|
+
status: response === null || response === void 0 ? void 0 : response.status
|
|
2274
|
+
});
|
|
2263
2275
|
if (!response.authResponse) {
|
|
2264
|
-
_context34.next =
|
|
2276
|
+
_context34.next = 17;
|
|
2265
2277
|
break;
|
|
2266
2278
|
}
|
|
2267
|
-
_context34.prev =
|
|
2268
|
-
|
|
2279
|
+
_context34.prev = 2;
|
|
2280
|
+
// 直接调用 /auth/facebook/login 接口
|
|
2281
|
+
console.log('[RegisterAndLogin] 调用后端 facebookLogin 接口');
|
|
2282
|
+
_context34.next = 6;
|
|
2269
2283
|
return _this2.apiCaller.call('facebookLogin', {
|
|
2270
2284
|
token: response.authResponse.accessToken
|
|
2271
2285
|
});
|
|
2272
|
-
case
|
|
2286
|
+
case 6:
|
|
2273
2287
|
result = _context34.sent;
|
|
2288
|
+
console.log('[RegisterAndLogin] facebookLogin 接口返回成功', {
|
|
2289
|
+
hasResult: Boolean(result)
|
|
2290
|
+
});
|
|
2274
2291
|
resolve(result);
|
|
2275
|
-
_context34.next =
|
|
2292
|
+
_context34.next = 15;
|
|
2276
2293
|
break;
|
|
2277
|
-
case 8:
|
|
2278
|
-
_context34.prev = 8;
|
|
2279
|
-
_context34.t0 = _context34["catch"](1);
|
|
2280
|
-
reject(_context34.t0);
|
|
2281
2294
|
case 11:
|
|
2282
|
-
_context34.
|
|
2295
|
+
_context34.prev = 11;
|
|
2296
|
+
_context34.t0 = _context34["catch"](2);
|
|
2297
|
+
console.error('[RegisterAndLogin] facebookLogin 接口调用失败', _context34.t0);
|
|
2298
|
+
reject(_context34.t0);
|
|
2299
|
+
case 15:
|
|
2300
|
+
_context34.next = 19;
|
|
2283
2301
|
break;
|
|
2284
|
-
case
|
|
2302
|
+
case 17:
|
|
2303
|
+
console.warn('[RegisterAndLogin] FB.login 用户取消授权或无 authResponse', response);
|
|
2285
2304
|
reject(new Error('facebook_login_cancel'));
|
|
2286
|
-
case
|
|
2305
|
+
case 19:
|
|
2287
2306
|
case "end":
|
|
2288
2307
|
return _context34.stop();
|
|
2289
2308
|
}
|
|
2290
|
-
}, _callee34, null, [[
|
|
2309
|
+
}, _callee34, null, [[2, 11]]);
|
|
2291
2310
|
}));
|
|
2292
2311
|
return function (_x31) {
|
|
2293
2312
|
return _ref.apply(this, arguments);
|
|
@@ -2296,7 +2315,7 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2296
2315
|
scope: 'email,public_profile'
|
|
2297
2316
|
});
|
|
2298
2317
|
}));
|
|
2299
|
-
case
|
|
2318
|
+
case 5:
|
|
2300
2319
|
case "end":
|
|
2301
2320
|
return _context35.stop();
|
|
2302
2321
|
}
|
|
@@ -2319,13 +2338,20 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2319
2338
|
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2320
2339
|
while (1) switch (_context37.prev = _context37.next) {
|
|
2321
2340
|
case 0:
|
|
2322
|
-
|
|
2341
|
+
// 先加载 Apple SDK
|
|
2342
|
+
console.log('[RegisterAndLogin] Apple 登录开始', {
|
|
2343
|
+
tokenLength: (token === null || token === void 0 ? void 0 : token.length) || 0,
|
|
2344
|
+
timestamp: Date.now()
|
|
2345
|
+
});
|
|
2346
|
+
_context37.next = 3;
|
|
2323
2347
|
return this.initAppleSDK();
|
|
2324
|
-
case
|
|
2348
|
+
case 3:
|
|
2349
|
+
console.log('[RegisterAndLogin] Apple SDK 初始化完成');
|
|
2325
2350
|
return _context37.abrupt("return", new Promise(function (resolve, reject) {
|
|
2326
2351
|
try {
|
|
2327
2352
|
var _AppleID, _AppleID2;
|
|
2328
2353
|
// 动态创建 Apple 登录按钮元素
|
|
2354
|
+
console.log('[RegisterAndLogin] 创建临时 Apple SignIn 按钮节点');
|
|
2329
2355
|
var appleSignInDiv = document.createElement('div');
|
|
2330
2356
|
appleSignInDiv.id = 'appleid-signin-temp';
|
|
2331
2357
|
appleSignInDiv.setAttribute('data-color', 'black');
|
|
@@ -2342,9 +2368,11 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2342
2368
|
|
|
2343
2369
|
// 将元素添加到 body 中
|
|
2344
2370
|
document.body.appendChild(appleSignInDiv);
|
|
2371
|
+
console.log('[RegisterAndLogin] Apple SignIn 按钮已添加到文档');
|
|
2345
2372
|
|
|
2346
2373
|
// 初始化 Apple ID 按钮
|
|
2347
2374
|
if ((_AppleID = window.AppleID) !== null && _AppleID !== void 0 && (_AppleID = _AppleID.auth) !== null && _AppleID !== void 0 && _AppleID.init) {
|
|
2375
|
+
console.log('[RegisterAndLogin] 调用 AppleID.auth.init');
|
|
2348
2376
|
window.AppleID.auth.init({
|
|
2349
2377
|
clientId: token,
|
|
2350
2378
|
// 使用传入的 token 作为 clientId
|
|
@@ -2353,10 +2381,13 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2353
2381
|
state: 'signin',
|
|
2354
2382
|
usePopup: true
|
|
2355
2383
|
});
|
|
2384
|
+
} else {
|
|
2385
|
+
console.warn('[RegisterAndLogin] AppleID.auth.init 方法不可用');
|
|
2356
2386
|
}
|
|
2357
2387
|
|
|
2358
2388
|
// 直接调用 Apple ID 登录,并处理 Promise
|
|
2359
2389
|
if ((_AppleID2 = window.AppleID) !== null && _AppleID2 !== void 0 && (_AppleID2 = _AppleID2.auth) !== null && _AppleID2 !== void 0 && _AppleID2.signIn) {
|
|
2390
|
+
console.log('[RegisterAndLogin] 调用 AppleID.auth.signIn');
|
|
2360
2391
|
window.AppleID.auth.signIn().then( /*#__PURE__*/function () {
|
|
2361
2392
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(authResult) {
|
|
2362
2393
|
var _authResult$authoriza, _authResult$authoriza2, authorizationCode, identityToken, result;
|
|
@@ -2368,28 +2399,44 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2368
2399
|
if (document.body.contains(appleSignInDiv)) {
|
|
2369
2400
|
document.body.removeChild(appleSignInDiv);
|
|
2370
2401
|
}
|
|
2402
|
+
console.log('[RegisterAndLogin] Apple SignIn 成功,临时节点已移除', {
|
|
2403
|
+
hasAuthorization: Boolean(authResult === null || authResult === void 0 ? void 0 : authResult.authorization),
|
|
2404
|
+
hasUser: Boolean(authResult === null || authResult === void 0 ? void 0 : authResult.user)
|
|
2405
|
+
});
|
|
2371
2406
|
|
|
2372
2407
|
// 获取授权码或令牌
|
|
2373
2408
|
authorizationCode = (_authResult$authoriza = authResult.authorization) === null || _authResult$authoriza === void 0 ? void 0 : _authResult$authoriza.code;
|
|
2374
|
-
identityToken = (_authResult$authoriza2 = authResult.authorization) === null || _authResult$authoriza2 === void 0 ? void 0 : _authResult$authoriza2.id_token;
|
|
2375
|
-
|
|
2409
|
+
identityToken = (_authResult$authoriza2 = authResult.authorization) === null || _authResult$authoriza2 === void 0 ? void 0 : _authResult$authoriza2.id_token;
|
|
2410
|
+
console.log('[RegisterAndLogin] Apple 授权结果解析', {
|
|
2411
|
+
hasAuthorizationCode: Boolean(authorizationCode),
|
|
2412
|
+
hasIdentityToken: Boolean(identityToken)
|
|
2413
|
+
});
|
|
2414
|
+
|
|
2415
|
+
// 使用授权码或身份令牌调用后端接口
|
|
2416
|
+
console.log('[RegisterAndLogin] 调用后端 appleLogin 接口');
|
|
2417
|
+
_context36.next = 9;
|
|
2376
2418
|
return _this3.apiCaller.call('appleLogin', {
|
|
2377
|
-
|
|
2419
|
+
code: identityToken || authorizationCode,
|
|
2420
|
+
login_channel: _this3.channel
|
|
2378
2421
|
});
|
|
2379
|
-
case
|
|
2422
|
+
case 9:
|
|
2380
2423
|
result = _context36.sent;
|
|
2424
|
+
console.log('[RegisterAndLogin] appleLogin 接口返回成功', {
|
|
2425
|
+
hasResult: Boolean(result)
|
|
2426
|
+
});
|
|
2381
2427
|
resolve(result);
|
|
2382
|
-
_context36.next =
|
|
2428
|
+
_context36.next = 18;
|
|
2383
2429
|
break;
|
|
2384
|
-
case
|
|
2385
|
-
_context36.prev =
|
|
2430
|
+
case 14:
|
|
2431
|
+
_context36.prev = 14;
|
|
2386
2432
|
_context36.t0 = _context36["catch"](0);
|
|
2433
|
+
console.error('[RegisterAndLogin] 处理 Apple 登录结果失败', _context36.t0);
|
|
2387
2434
|
reject(_context36.t0);
|
|
2388
|
-
case
|
|
2435
|
+
case 18:
|
|
2389
2436
|
case "end":
|
|
2390
2437
|
return _context36.stop();
|
|
2391
2438
|
}
|
|
2392
|
-
}, _callee36, null, [[0,
|
|
2439
|
+
}, _callee36, null, [[0, 14]]);
|
|
2393
2440
|
}));
|
|
2394
2441
|
return function (_x33) {
|
|
2395
2442
|
return _ref2.apply(this, arguments);
|
|
@@ -2399,16 +2446,19 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2399
2446
|
if (document.body.contains(appleSignInDiv)) {
|
|
2400
2447
|
document.body.removeChild(appleSignInDiv);
|
|
2401
2448
|
}
|
|
2449
|
+
console.error('[RegisterAndLogin] Apple SignIn Promise 拒绝', error);
|
|
2402
2450
|
reject(new Error('Apple 登录失败: ' + ((error === null || error === void 0 ? void 0 : error.error) || (error === null || error === void 0 ? void 0 : error.message) || '未知错误')));
|
|
2403
2451
|
});
|
|
2404
2452
|
} else {
|
|
2453
|
+
console.error('[RegisterAndLogin] AppleID.auth.signIn 方法不可用');
|
|
2405
2454
|
reject(new Error('Apple SDK 未正确加载'));
|
|
2406
2455
|
}
|
|
2407
2456
|
} catch (error) {
|
|
2457
|
+
console.error('[RegisterAndLogin] Apple 登录流程异常', error);
|
|
2408
2458
|
reject(error);
|
|
2409
2459
|
}
|
|
2410
2460
|
}));
|
|
2411
|
-
case
|
|
2461
|
+
case 5:
|
|
2412
2462
|
case "end":
|
|
2413
2463
|
return _context37.stop();
|
|
2414
2464
|
}
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -299,6 +299,12 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
299
299
|
errorList: any[];
|
|
300
300
|
};
|
|
301
301
|
getTimeSlotByAllResources(resources_code: string): any[];
|
|
302
|
+
getTimeSlotByAllResourcesForDate(resources_code: string, start_date: string, end_date: string): Promise<{
|
|
303
|
+
date: string;
|
|
304
|
+
status: string;
|
|
305
|
+
week: string;
|
|
306
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
307
|
+
}[]>;
|
|
302
308
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
303
309
|
private getScheduleDataByIds;
|
|
304
310
|
openProductDetail(productId: number): Promise<void>;
|
|
@@ -1545,6 +1545,157 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1545
1545
|
});
|
|
1546
1546
|
return timeSlots;
|
|
1547
1547
|
}
|
|
1548
|
+
// 从购物车中获取已经分配好第一步资源的所有时间片,批量版本,用于给日期提供能否高亮的判断
|
|
1549
|
+
async getTimeSlotByAllResourcesForDate(resources_code, start_date, end_date) {
|
|
1550
|
+
var _a, _b, _c, _d;
|
|
1551
|
+
if ((0, import_dayjs.default)(end_date).diff((0, import_dayjs.default)(start_date), "day") < 30) {
|
|
1552
|
+
end_date = (0, import_dayjs.default)(start_date).add(30, "day").format("YYYY-MM-DD");
|
|
1553
|
+
}
|
|
1554
|
+
await this.getAvailableDate({
|
|
1555
|
+
startDate: start_date,
|
|
1556
|
+
endDate: end_date,
|
|
1557
|
+
useCache: true
|
|
1558
|
+
});
|
|
1559
|
+
const resources = [];
|
|
1560
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils5.isNormalProduct)(n._productOrigin));
|
|
1561
|
+
const resourceIds = [];
|
|
1562
|
+
let resourcesTypeId = void 0;
|
|
1563
|
+
let isSingleResource = false;
|
|
1564
|
+
let maxCutOffTime = void 0;
|
|
1565
|
+
let maxCutOffTimeValue = (0, import_dayjs.default)();
|
|
1566
|
+
cartItems.forEach((item) => {
|
|
1567
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i;
|
|
1568
|
+
(_c2 = (_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.forEach((n) => {
|
|
1569
|
+
if (n.code === resources_code) {
|
|
1570
|
+
resources.push(...n.renderList || []);
|
|
1571
|
+
isSingleResource = n.type === "single";
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1574
|
+
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
1575
|
+
resourceIds.push(item.resource_id);
|
|
1576
|
+
}
|
|
1577
|
+
resourcesTypeId = (_g = (_f = (_e = (_d2 = item == null ? void 0 : item._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e.resources) == null ? void 0 : _f.find(
|
|
1578
|
+
(n) => n.code === resources_code
|
|
1579
|
+
)) == null ? void 0 : _g.id;
|
|
1580
|
+
if (((_h = item._productOrigin) == null ? void 0 : _h.cut_off_time) && ((_i = item._productOrigin) == null ? void 0 : _i.cut_off_time.type) === "advance") {
|
|
1581
|
+
const currentCutOffTime = (0, import_dayjs.default)().add(
|
|
1582
|
+
item._productOrigin.cut_off_time.unit,
|
|
1583
|
+
item._productOrigin.cut_off_time.unit_type
|
|
1584
|
+
);
|
|
1585
|
+
if (currentCutOffTime.isAfter(maxCutOffTimeValue, "minute")) {
|
|
1586
|
+
maxCutOffTimeValue = currentCutOffTime;
|
|
1587
|
+
maxCutOffTime = item._productOrigin.cut_off_time;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
});
|
|
1591
|
+
const resourcesMap = (0, import_utils2.getResourcesMap)(resources);
|
|
1592
|
+
let duration = 0;
|
|
1593
|
+
const accountList = this.store.accountList.getAccounts();
|
|
1594
|
+
const checkDuration = (cartItems2) => {
|
|
1595
|
+
let accountDuration = 0;
|
|
1596
|
+
cartItems2.forEach((item) => {
|
|
1597
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
1598
|
+
if (isSingleResource) {
|
|
1599
|
+
accountDuration += ((_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.value) || 10;
|
|
1600
|
+
} else {
|
|
1601
|
+
if (accountDuration < (((_d2 = (_c2 = item._productOrigin) == null ? void 0 : _c2.duration) == null ? void 0 : _d2.value) || 10)) {
|
|
1602
|
+
accountDuration = ((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
if (accountDuration > duration) {
|
|
1607
|
+
duration = accountDuration;
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
1611
|
+
accountList.forEach((account) => {
|
|
1612
|
+
const cartItems2 = this.store.cart.getCartByAccount(account.getId());
|
|
1613
|
+
checkDuration(cartItems2);
|
|
1614
|
+
});
|
|
1615
|
+
} else {
|
|
1616
|
+
checkDuration(cartItems);
|
|
1617
|
+
}
|
|
1618
|
+
if (!((_a = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _a.start_date) && !((_b = cartItems == null ? void 0 : cartItems[0]) == null ? void 0 : _b.resource_id) || !(cartItems == null ? void 0 : cartItems[0].duration)) {
|
|
1619
|
+
return [];
|
|
1620
|
+
}
|
|
1621
|
+
const resourcesUseableMap = {};
|
|
1622
|
+
const hasFlexibleDuration = cartItems.some(
|
|
1623
|
+
(item) => {
|
|
1624
|
+
var _a2, _b2;
|
|
1625
|
+
return ((_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.type) === "flexible";
|
|
1626
|
+
}
|
|
1627
|
+
);
|
|
1628
|
+
let operating_day_boundary = (_d = (_c = this.shopStore.get("core")) == null ? void 0 : _c.core) == null ? void 0 : _d.operating_day_boundary;
|
|
1629
|
+
let maxBlockThreshold = 0;
|
|
1630
|
+
if (hasFlexibleDuration) {
|
|
1631
|
+
maxBlockThreshold = cartItems.reduce((max, item) => {
|
|
1632
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
1633
|
+
if ((_c2 = (_b2 = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.flexible_config) == null ? void 0 : _c2.is_enable_minimum_duration) {
|
|
1634
|
+
return Math.max(max, ((_f = (_e = (_d2 = item._productOrigin) == null ? void 0 : _d2.duration) == null ? void 0 : _e.flexible_config) == null ? void 0 : _f.block_threshold) || 0);
|
|
1635
|
+
}
|
|
1636
|
+
return 0;
|
|
1637
|
+
}, 0);
|
|
1638
|
+
}
|
|
1639
|
+
const calculateCapacityFromCartItems = (items) => {
|
|
1640
|
+
return items.reduce((total, item) => {
|
|
1641
|
+
return total + ((0, import_capacity.getCapacityInfoByCartItem)(item).currentCapacity || 0);
|
|
1642
|
+
}, 0);
|
|
1643
|
+
};
|
|
1644
|
+
let maxCapacity = 1;
|
|
1645
|
+
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
1646
|
+
accountList.forEach((account) => {
|
|
1647
|
+
const accountCartItems = this.store.cart.getCartByAccount(account.getId());
|
|
1648
|
+
const currentCapacity = calculateCapacityFromCartItems(accountCartItems);
|
|
1649
|
+
if (currentCapacity > maxCapacity) {
|
|
1650
|
+
maxCapacity = currentCapacity;
|
|
1651
|
+
}
|
|
1652
|
+
});
|
|
1653
|
+
} else {
|
|
1654
|
+
maxCapacity = calculateCapacityFromCartItems(cartItems);
|
|
1655
|
+
}
|
|
1656
|
+
const arr = [];
|
|
1657
|
+
const today = (0, import_dayjs.default)().startOf("day");
|
|
1658
|
+
for (let i = (0, import_dayjs.default)(start_date); i.isBefore((0, import_dayjs.default)(end_date)); i = i.add(1, "day")) {
|
|
1659
|
+
if (i.isBefore(today)) {
|
|
1660
|
+
arr.push({
|
|
1661
|
+
date: i.format("YYYY-MM-DD"),
|
|
1662
|
+
status: "unavailable",
|
|
1663
|
+
week: i.format("ddd"),
|
|
1664
|
+
weekNum: i.day()
|
|
1665
|
+
});
|
|
1666
|
+
continue;
|
|
1667
|
+
}
|
|
1668
|
+
const timeSlots = (0, import_resources.getTimeSlicesByResources)({
|
|
1669
|
+
resourceIds,
|
|
1670
|
+
resourcesMap,
|
|
1671
|
+
duration,
|
|
1672
|
+
currentDate: i.format("YYYY-MM-DD"),
|
|
1673
|
+
split: 10,
|
|
1674
|
+
resourcesUseableMap,
|
|
1675
|
+
capacity: maxCapacity,
|
|
1676
|
+
cut_off_time: maxCutOffTime,
|
|
1677
|
+
hasFlexibleDuration,
|
|
1678
|
+
operating_day_boundary,
|
|
1679
|
+
maxBlockThreshold
|
|
1680
|
+
});
|
|
1681
|
+
if (timeSlots.length > 0) {
|
|
1682
|
+
arr.push({
|
|
1683
|
+
date: i.format("YYYY-MM-DD"),
|
|
1684
|
+
status: "available",
|
|
1685
|
+
week: i.format("ddd"),
|
|
1686
|
+
weekNum: i.day()
|
|
1687
|
+
});
|
|
1688
|
+
} else {
|
|
1689
|
+
arr.push({
|
|
1690
|
+
date: i.format("YYYY-MM-DD"),
|
|
1691
|
+
status: "unavailable",
|
|
1692
|
+
week: i.format("ddd"),
|
|
1693
|
+
weekNum: i.day()
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return arr;
|
|
1698
|
+
}
|
|
1548
1699
|
// 提交时间切片,绑定到对应购物车的商品上,更新购物车---只有 duration 商品
|
|
1549
1700
|
submitTimeSlot(timeSlots) {
|
|
1550
1701
|
var _a, _b;
|
|
@@ -1783,6 +1934,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1783
1934
|
});
|
|
1784
1935
|
const cartItems2 = this.store.cart.getItems();
|
|
1785
1936
|
productResources.forEach((n) => {
|
|
1937
|
+
debugger;
|
|
1786
1938
|
if (n.type === "single") {
|
|
1787
1939
|
const currentResourcesSet = /* @__PURE__ */ new Set([...n.optional_resource, ...n.default_resource]);
|
|
1788
1940
|
const sameCartItems = cartItems2.filter((m) => {
|
|
@@ -1793,13 +1945,17 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1793
1945
|
bookingLeft = 0;
|
|
1794
1946
|
count = 0;
|
|
1795
1947
|
}
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1948
|
+
let otherCartItems = cartItems2.filter(
|
|
1949
|
+
(m) => {
|
|
1950
|
+
var _a2, _b2, _c2, _d2, _e2, _f;
|
|
1951
|
+
const isTimeMatch = ((_b2 = (_a2 = m._productOrigin) == null ? void 0 : _a2.id) == null ? void 0 : _b2.toString()) !== ((_c2 = targetProductData == null ? void 0 : targetProductData.id) == null ? void 0 : _c2.toString()) && `${m.start_date} ${m.start_time}` === item.start && `${m.start_date} ${m.end_time}` === item.end;
|
|
1952
|
+
const isResourceMatch = (_f = (_e2 = (_d2 = m._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f.find((m2) => m2.type === n.type && m2.status === 1);
|
|
1953
|
+
return isTimeMatch && isResourceMatch;
|
|
1954
|
+
}
|
|
1955
|
+
);
|
|
1800
1956
|
otherCartItems.forEach((m) => {
|
|
1801
1957
|
var _a2, _b2, _c2;
|
|
1802
|
-
const sameTypeResources = (_c2 = (_b2 = (_a2 = m._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.find((m2) => m2.type === n.type);
|
|
1958
|
+
const sameTypeResources = (_c2 = (_b2 = (_a2 = m._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) == null ? void 0 : _c2.find((m2) => m2.type === n.type && m2.status === 1);
|
|
1803
1959
|
const sameTypeResourcesSet = /* @__PURE__ */ new Set([...(sameTypeResources == null ? void 0 : sameTypeResources.optional_resource) || [], ...(sameTypeResources == null ? void 0 : sameTypeResources.default_resource) || []]);
|
|
1804
1960
|
sameTypeResourcesSet.forEach((resource) => currentResourcesSet.add(resource));
|
|
1805
1961
|
});
|
|
@@ -249,8 +249,7 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
249
249
|
let availableResourceCount = 0;
|
|
250
250
|
resourcesInType.forEach((resource) => {
|
|
251
251
|
const availableTimes = resource.times.filter((time) => {
|
|
252
|
-
|
|
253
|
-
return !(0, import_dayjs.default)(time.start_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && !(0, import_dayjs.default)(time.end_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") || (0, import_dayjs.default)(time.start_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") && (0, import_dayjs.default)(time.end_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && ((_a2 = time.event_list) == null ? void 0 : _a2.length) === 0;
|
|
252
|
+
return !(0, import_dayjs.default)(time.start_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && !(0, import_dayjs.default)(time.end_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") || (0, import_dayjs.default)(time.start_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") && (0, import_dayjs.default)(time.end_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute");
|
|
254
253
|
});
|
|
255
254
|
if (availableTimes.length > 0) {
|
|
256
255
|
availableResourceCount++;
|
|
@@ -122,6 +122,12 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
122
122
|
throw error;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* 初始化外设扫码结果监听
|
|
127
|
+
*/
|
|
128
|
+
initPeripheralsListener() {
|
|
129
|
+
this.scan.initPeripheralsListener();
|
|
130
|
+
}
|
|
125
131
|
/**
|
|
126
132
|
* 获取商品列表(不加载到模块中)
|
|
127
133
|
* @returns 商品列表
|
|
@@ -157,7 +157,8 @@ var onlineStoreConfig = {
|
|
|
157
157
|
transformParams: (params) => ({
|
|
158
158
|
phone: String(params.phone),
|
|
159
159
|
code: params.code,
|
|
160
|
-
country_calling_code: String(params.country_calling_code)
|
|
160
|
+
country_calling_code: String(params.country_calling_code),
|
|
161
|
+
action: params.action
|
|
161
162
|
})
|
|
162
163
|
},
|
|
163
164
|
phonePasswordLogin: {
|
|
@@ -276,7 +277,7 @@ var onlineStoreConfig = {
|
|
|
276
277
|
url: "/auth/apple/login",
|
|
277
278
|
method: "POST",
|
|
278
279
|
transformParams: (params) => ({
|
|
279
|
-
|
|
280
|
+
code: params.code
|
|
280
281
|
})
|
|
281
282
|
}
|
|
282
283
|
};
|
|
@@ -407,7 +408,8 @@ var defaultConfig = {
|
|
|
407
408
|
transformParams: (params) => ({
|
|
408
409
|
phone: String(params.phone),
|
|
409
410
|
code: params.code,
|
|
410
|
-
country_calling_code: String(params.country_calling_code)
|
|
411
|
+
country_calling_code: String(params.country_calling_code),
|
|
412
|
+
action: params.action
|
|
411
413
|
})
|
|
412
414
|
},
|
|
413
415
|
phonePasswordLogin: {
|
|
@@ -526,7 +528,7 @@ var defaultConfig = {
|
|
|
526
528
|
url: "/auth/apple/login",
|
|
527
529
|
method: "POST",
|
|
528
530
|
transformParams: (params) => ({
|
|
529
|
-
|
|
531
|
+
code: params.code
|
|
530
532
|
})
|
|
531
533
|
}
|
|
532
534
|
};
|