@pisell/pisellos 0.0.231 → 0.0.233
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/Order/index.js +18 -9
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Payment/types.d.ts +3 -2
- package/dist/modules/Payment/walletpass.js +15 -9
- package/dist/modules/Schedule/index.d.ts +1 -1
- package/dist/modules/Schedule/index.js +20 -12
- package/dist/solution/BookingByStep/utils/timeslots.js +114 -72
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +21 -0
- package/dist/solution/Checkout/index.js +798 -643
- package/dist/solution/Checkout/types.d.ts +14 -0
- package/lib/modules/Order/index.js +13 -6
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Payment/types.d.ts +3 -2
- package/lib/modules/Payment/walletpass.js +13 -9
- package/lib/modules/Schedule/index.d.ts +1 -1
- package/lib/modules/Schedule/index.js +24 -9
- package/lib/solution/BookingByStep/utils/timeslots.js +72 -53
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +21 -0
- package/lib/solution/Checkout/index.js +114 -19
- package/lib/solution/Checkout/types.d.ts +14 -0
- package/package.json +1 -1
|
@@ -170,7 +170,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
170
170
|
value: (function () {
|
|
171
171
|
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
172
172
|
var _params$bookings, _params$relation_prod, _params$payments;
|
|
173
|
-
var _orderData$bookings, _orderData$relation_p, _orderData$
|
|
173
|
+
var _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _response$data, orderData, response;
|
|
174
174
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
175
175
|
while (1) switch (_context3.prev = _context3.next) {
|
|
176
176
|
case 0:
|
|
@@ -196,6 +196,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
196
196
|
relation_forms: [],
|
|
197
197
|
payments: []
|
|
198
198
|
}, params);
|
|
199
|
+
if ((_orderData$payments = orderData.payments) !== null && _orderData$payments !== void 0 && _orderData$payments.length) {
|
|
200
|
+
orderData.small_ticket_data_flag = 1;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 如果进来的order_id 是真实的,则不需要再传递 bookings 和 relation_products
|
|
204
|
+
if (params.order_id) {
|
|
205
|
+
orderData.bookings = [];
|
|
206
|
+
orderData.relation_products = [];
|
|
207
|
+
}
|
|
199
208
|
console.log('[Order] 调用后端接口创建订单:', {
|
|
200
209
|
url: '/order/checkout',
|
|
201
210
|
orderType: orderData.type,
|
|
@@ -204,32 +213,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
204
213
|
customerId: orderData.customer_id,
|
|
205
214
|
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
206
215
|
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
207
|
-
paymentsCount: ((_orderData$
|
|
208
|
-
paymentsMethods: ((_orderData$
|
|
216
|
+
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
217
|
+
paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
209
218
|
return p.code;
|
|
210
219
|
})) || []
|
|
211
220
|
});
|
|
212
221
|
|
|
213
222
|
// 调用后端接口
|
|
214
|
-
_context3.next =
|
|
223
|
+
_context3.next = 8;
|
|
215
224
|
return this.request.post('/order/checkout', orderData);
|
|
216
|
-
case
|
|
225
|
+
case 8:
|
|
217
226
|
response = _context3.sent;
|
|
218
227
|
console.log('[Order] 订单创建成功,后端响应:', {
|
|
219
228
|
success: !!response,
|
|
220
229
|
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
221
230
|
});
|
|
222
231
|
return _context3.abrupt("return", response);
|
|
223
|
-
case
|
|
224
|
-
_context3.prev =
|
|
232
|
+
case 13:
|
|
233
|
+
_context3.prev = 13;
|
|
225
234
|
_context3.t0 = _context3["catch"](1);
|
|
226
235
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
|
|
227
236
|
throw _context3.t0;
|
|
228
|
-
case
|
|
237
|
+
case 17:
|
|
229
238
|
case "end":
|
|
230
239
|
return _context3.stop();
|
|
231
240
|
}
|
|
232
|
-
}, _callee3, this, [[1,
|
|
241
|
+
}, _callee3, this, [[1, 13]]);
|
|
233
242
|
}));
|
|
234
243
|
function createOrderByCheckout(_x4) {
|
|
235
244
|
return _createOrderByCheckout.apply(this, arguments);
|
|
@@ -509,7 +509,7 @@ export interface WalletDeductionRecommendParams {
|
|
|
509
509
|
/** 前端设置只想要的字段 */
|
|
510
510
|
expect_columns?: string[];
|
|
511
511
|
/** 客户id */
|
|
512
|
-
customer_id
|
|
512
|
+
customer_id?: number;
|
|
513
513
|
/** 订单总计金额 */
|
|
514
514
|
order_expect_amount: number;
|
|
515
515
|
/** 订单小计金额 */
|
|
@@ -517,7 +517,7 @@ export interface WalletDeductionRecommendParams {
|
|
|
517
517
|
/** 订单待支付金额 */
|
|
518
518
|
order_wait_pay_amount: number;
|
|
519
519
|
/** 统计计数用户id */
|
|
520
|
-
order_behavior_count_customer_id
|
|
520
|
+
order_behavior_count_customer_id?: number;
|
|
521
521
|
/** 已选商品 */
|
|
522
522
|
products: {
|
|
523
523
|
/** 商品id */
|
|
@@ -555,6 +555,7 @@ export interface WalletInitBusinessData {
|
|
|
555
555
|
quantity: number;
|
|
556
556
|
selling_price: number;
|
|
557
557
|
}[];
|
|
558
|
+
order_wait_pay_amount?: number;
|
|
558
559
|
}
|
|
559
560
|
/**
|
|
560
561
|
* 查询用户识别码列表请求参数
|
|
@@ -55,17 +55,22 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
55
55
|
value: function generateWalletParams(businessData) {
|
|
56
56
|
var customer_id = businessData.customer_id,
|
|
57
57
|
amountInfo = businessData.amountInfo,
|
|
58
|
-
products = businessData.products
|
|
58
|
+
products = businessData.products,
|
|
59
|
+
order_wait_pay_amount = businessData.order_wait_pay_amount;
|
|
59
60
|
|
|
60
61
|
// 转换金额为数字类型
|
|
61
|
-
var totalAmount = Number(amountInfo.
|
|
62
|
+
var totalAmount = Number(amountInfo.totalAmount);
|
|
63
|
+
var subTotal = Number(amountInfo.subTotal);
|
|
62
64
|
var walletParams = {
|
|
63
|
-
sale_channel: '
|
|
64
|
-
customer_id:
|
|
65
|
+
sale_channel: 'pos',
|
|
66
|
+
customer_id: customer_id || 0,
|
|
67
|
+
// 提供默认值,确保类型为 number
|
|
65
68
|
order_expect_amount: totalAmount,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
// 订单小计金额
|
|
70
|
+
order_product_amount: subTotal,
|
|
71
|
+
// 订单待支付金额
|
|
72
|
+
order_wait_pay_amount: order_wait_pay_amount || totalAmount,
|
|
73
|
+
// order_behavior_count_customer_id: 1,
|
|
69
74
|
products: products,
|
|
70
75
|
prepare_payments: []
|
|
71
76
|
};
|
|
@@ -207,7 +212,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
207
212
|
_context3.prev = 10;
|
|
208
213
|
_context3.t0 = _context3["catch"](0);
|
|
209
214
|
console.error('获取钱包推荐列表失败:', _context3.t0);
|
|
210
|
-
throw
|
|
215
|
+
// throw error;
|
|
216
|
+
return _context3.abrupt("return", []);
|
|
211
217
|
case 14:
|
|
212
218
|
case "end":
|
|
213
219
|
return _context3.stop();
|
|
@@ -252,7 +258,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
252
258
|
_context4.prev = 12;
|
|
253
259
|
_context4.t0 = _context4["catch"](0);
|
|
254
260
|
console.error('获取用户识别码列表失败:', _context4.t0);
|
|
255
|
-
|
|
261
|
+
return _context4.abrupt("return", []);
|
|
256
262
|
case 16:
|
|
257
263
|
case "end":
|
|
258
264
|
return _context4.stop();
|
|
@@ -30,7 +30,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
30
30
|
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
|
-
static isInScheduleByDate({ date, schedule }: {
|
|
33
|
+
static isInScheduleByDate({ date, schedule, }: {
|
|
34
34
|
date: string;
|
|
35
35
|
schedule: any;
|
|
36
36
|
}): true | undefined;
|
|
@@ -246,7 +246,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
246
246
|
/**
|
|
247
247
|
* 传入一个时间, 判断改时间是否在schedule 内
|
|
248
248
|
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
249
|
-
* @returns
|
|
249
|
+
* @returns
|
|
250
250
|
*/
|
|
251
251
|
}], [{
|
|
252
252
|
key: "isInScheduleByDate",
|
|
@@ -257,23 +257,31 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
257
257
|
// 节约性能, 强制将schedule的时间范围改为前后一天,避免大量计算.
|
|
258
258
|
var _schedule = _objectSpread(_objectSpread({}, schedule), {}, {
|
|
259
259
|
// 开始时间向前推一天
|
|
260
|
-
start_time: dayjs(date).subtract(1,
|
|
261
|
-
end_time: dayjs(date).add(1,
|
|
260
|
+
start_time: dayjs(date).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'),
|
|
261
|
+
end_time: dayjs(date).add(1, 'day').format('YYYY-MM-DD HH:mm:ss')
|
|
262
262
|
});
|
|
263
263
|
|
|
264
264
|
// 不限制的 改为后一天
|
|
265
|
-
if (((_schedule$repeat_rule = _schedule.repeat_rule) === null || _schedule$repeat_rule === void 0 || (_schedule$repeat_rule = _schedule$repeat_rule.end) === null || _schedule$repeat_rule === void 0 ? void 0 : _schedule$repeat_rule.type) ===
|
|
266
|
-
_schedule
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
if (((_schedule$repeat_rule = _schedule.repeat_rule) === null || _schedule$repeat_rule === void 0 || (_schedule$repeat_rule = _schedule$repeat_rule.end) === null || _schedule$repeat_rule === void 0 ? void 0 : _schedule$repeat_rule.type) === 'never') {
|
|
266
|
+
_schedule = _objectSpread(_objectSpread({}, _schedule), {}, {
|
|
267
|
+
repeat_rule: _objectSpread(_objectSpread({}, _schedule.repeat_rule), {}, {
|
|
268
|
+
end: {
|
|
269
|
+
type: 'date',
|
|
270
|
+
end_date: _schedule.end_time,
|
|
271
|
+
occurrence: null
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
});
|
|
271
275
|
}
|
|
272
276
|
|
|
273
277
|
// 限制结束日期的也改为后一天
|
|
274
|
-
if (((_schedule$repeat_rule2 = _schedule.repeat_rule) === null || _schedule$repeat_rule2 === void 0 || (_schedule$repeat_rule2 = _schedule$repeat_rule2.end) === null || _schedule$repeat_rule2 === void 0 ? void 0 : _schedule$repeat_rule2.type) ===
|
|
275
|
-
_schedule
|
|
276
|
-
|
|
278
|
+
if (((_schedule$repeat_rule2 = _schedule.repeat_rule) === null || _schedule$repeat_rule2 === void 0 || (_schedule$repeat_rule2 = _schedule$repeat_rule2.end) === null || _schedule$repeat_rule2 === void 0 ? void 0 : _schedule$repeat_rule2.type) === 'date') {
|
|
279
|
+
_schedule = _objectSpread(_objectSpread({}, _schedule), {}, {
|
|
280
|
+
repeat_rule: _objectSpread(_objectSpread({}, _schedule.repeat_rule), {}, {
|
|
281
|
+
end: _objectSpread(_objectSpread({}, _schedule.repeat_rule.end), {}, {
|
|
282
|
+
end_date: _schedule.end_time
|
|
283
|
+
})
|
|
284
|
+
})
|
|
277
285
|
});
|
|
278
286
|
}
|
|
279
287
|
var dateRanges = calcScheduleDateRange(_objectSpread({}, _schedule));
|
|
@@ -95,71 +95,122 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
95
95
|
var currentTime = dayjs();
|
|
96
96
|
var fastestTime = null;
|
|
97
97
|
var fastestResources = [];
|
|
98
|
+
console.log('[TimeslotUtils] 查找最快可用资源:', {
|
|
99
|
+
currentTime: currentTime.format('YYYY-MM-DD HH:mm:ss'),
|
|
100
|
+
resourceCount: resources.length,
|
|
101
|
+
currentCapacity: currentCapacity,
|
|
102
|
+
countMap: countMap
|
|
103
|
+
});
|
|
98
104
|
|
|
99
105
|
// 遍历所有资源,找到最快可用的时间点
|
|
100
106
|
var _iterator2 = _createForOfIteratorHelper(resources),
|
|
101
107
|
_step2;
|
|
102
108
|
try {
|
|
103
109
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
104
|
-
var
|
|
105
|
-
//
|
|
106
|
-
var todayTimes =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// 按开始时间排序
|
|
112
|
-
todayTimes.sort(function (a, b) {
|
|
113
|
-
return dayjs(a.start_at).diff(dayjs(b.start_at));
|
|
110
|
+
var resource = _step2.value;
|
|
111
|
+
// 获取资源当天且还在工作时间内的时间段
|
|
112
|
+
var todayTimes = resource.times.filter(function (time) {
|
|
113
|
+
var isToday = dayjs(time.start_at).isSame(currentTime, 'day');
|
|
114
|
+
var isStillWorking = dayjs(time.end_at).isAfter(currentTime);
|
|
115
|
+
return isToday && isStillWorking;
|
|
114
116
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
if (todayTimes.length === 0) {
|
|
118
|
+
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(resource.id, "(").concat(resource.main_field, ") \u4ECA\u65E5\u65E0\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
117
121
|
var _iterator3 = _createForOfIteratorHelper(todayTimes),
|
|
118
122
|
_step3;
|
|
119
123
|
try {
|
|
120
124
|
var _loop = function _loop() {
|
|
125
|
+
var _time$event_list, _time$event_list2;
|
|
121
126
|
var time = _step3.value;
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
127
|
+
var workStartTime = dayjs(time.start_at);
|
|
128
|
+
var workEndTime = dayjs(time.end_at);
|
|
129
|
+
|
|
130
|
+
// 确定检查的起始时间(当前时间 vs 工作开始时间)
|
|
131
|
+
var nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
|
|
132
|
+
console.log("[TimeslotUtils] \u68C0\u67E5\u8D44\u6E90 ".concat(resource.id, "(").concat(resource.main_field, "):"), {
|
|
133
|
+
workTime: "".concat(workStartTime.format('HH:mm'), "-").concat(workEndTime.format('HH:mm')),
|
|
134
|
+
checkStartTime: nextAvailableTime.format('HH:mm:ss'),
|
|
135
|
+
eventCount: ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.length) || 0
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// 获取所有影响的预约事件(当前时间之后的)
|
|
139
|
+
var relevantEvents = ((_time$event_list2 = time.event_list) === null || _time$event_list2 === void 0 ? void 0 : _time$event_list2.filter(function (event) {
|
|
140
|
+
var eventEnd = dayjs(event.end_at);
|
|
141
|
+
return eventEnd.isAfter(nextAvailableTime);
|
|
142
|
+
})) || [];
|
|
143
|
+
|
|
144
|
+
// 按开始时间排序
|
|
145
|
+
relevantEvents.sort(function (a, b) {
|
|
146
|
+
return dayjs(a.start_at).diff(dayjs(b.start_at));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// 检查从 nextAvailableTime 开始的可用性
|
|
150
|
+
var finalAvailableTime = nextAvailableTime;
|
|
151
|
+
var _iterator4 = _createForOfIteratorHelper(relevantEvents),
|
|
152
|
+
_step4;
|
|
153
|
+
try {
|
|
154
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
155
|
+
var event = _step4.value;
|
|
156
|
+
var eventStart = dayjs(event.start_at);
|
|
157
|
+
var eventEnd = dayjs(event.end_at);
|
|
158
|
+
console.log("[TimeslotUtils] \u68C0\u67E5\u4E8B\u4EF6\u51B2\u7A81:", {
|
|
159
|
+
resourceId: resource.id,
|
|
160
|
+
eventTime: "".concat(eventStart.format('HH:mm'), "-").concat(eventEnd.format('HH:mm')),
|
|
161
|
+
checkTime: finalAvailableTime.format('HH:mm:ss'),
|
|
162
|
+
pax: event.pax || 1
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// 检查资源类型和容量
|
|
166
|
+
if (resource.resourceType === 'single' || (resource.capacity || 1) === 1) {
|
|
167
|
+
// 单人预约资源:检查时间冲突
|
|
168
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, 'minute'))) {
|
|
169
|
+
// 有冲突,使用事件结束时间
|
|
170
|
+
finalAvailableTime = eventEnd;
|
|
171
|
+
console.log("[TimeslotUtils] \u53D1\u73B0\u65F6\u95F4\u51B2\u7A81\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
// 多人预约资源:检查容量
|
|
175
|
+
var totalCapacity = resource.capacity || 0;
|
|
176
|
+
var currentUsedCapacity = countMap[resource.id] || 0;
|
|
177
|
+
var eventUsedCapacity = event.pax || 1;
|
|
178
|
+
|
|
179
|
+
// 如果在事件时间范围内,检查容量是否足够
|
|
180
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, 'minute'))) {
|
|
181
|
+
var totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
182
|
+
if (totalRequiredCapacity > totalCapacity) {
|
|
183
|
+
// 容量不足,使用事件结束时间
|
|
184
|
+
finalAvailableTime = eventEnd;
|
|
185
|
+
console.log("[TimeslotUtils] \u5BB9\u91CF\u4E0D\u8DB3\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
159
188
|
}
|
|
160
|
-
return 1; // break
|
|
161
189
|
}
|
|
190
|
+
|
|
191
|
+
// 确保可用时间在工作时间内
|
|
192
|
+
} catch (err) {
|
|
193
|
+
_iterator4.e(err);
|
|
194
|
+
} finally {
|
|
195
|
+
_iterator4.f();
|
|
196
|
+
}
|
|
197
|
+
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
198
|
+
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(resource.id, " \u53EF\u7528\u65F6\u95F4\u8D85\u51FA\u5DE5\u4F5C\u65F6\u95F4\uFF0C\u8DF3\u8FC7"));
|
|
199
|
+
return 0; // continue
|
|
162
200
|
}
|
|
201
|
+
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(resource.id, "(").concat(resource.main_field, ") \u6700\u5FEB\u53EF\u7528\u65F6\u95F4: ").concat(finalAvailableTime.format('HH:mm:ss')));
|
|
202
|
+
|
|
203
|
+
// 更新最快可用时间和资源
|
|
204
|
+
if (!fastestTime || finalAvailableTime.isBefore(fastestTime)) {
|
|
205
|
+
fastestTime = finalAvailableTime;
|
|
206
|
+
fastestResources = [resource];
|
|
207
|
+
console.log("[TimeslotUtils] \u66F4\u65B0\u6700\u5FEB\u65F6\u95F4: ".concat(fastestTime.format('HH:mm:ss'), ", \u8D44\u6E90: ").concat(resource.main_field));
|
|
208
|
+
} else if (finalAvailableTime.isSame(fastestTime)) {
|
|
209
|
+
fastestResources.push(resource);
|
|
210
|
+
console.log("[TimeslotUtils] \u6DFB\u52A0\u76F8\u540C\u65F6\u95F4\u8D44\u6E90: ".concat(resource.main_field));
|
|
211
|
+
}
|
|
212
|
+
return 1; // break
|
|
213
|
+
// 每个资源只需要计算一次
|
|
163
214
|
},
|
|
164
215
|
_ret;
|
|
165
216
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
@@ -180,31 +231,22 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
180
231
|
} finally {
|
|
181
232
|
_iterator2.f();
|
|
182
233
|
}
|
|
183
|
-
if (!fastestTime || fastestResources.length === 0)
|
|
234
|
+
if (!fastestTime || fastestResources.length === 0) {
|
|
235
|
+
console.log('[TimeslotUtils] 未找到可用资源');
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
console.log("[TimeslotUtils] \u627E\u5230 ".concat(fastestResources.length, " \u4E2A\u6700\u5FEB\u53EF\u7528\u8D44\u6E90\uFF0C\u65F6\u95F4: ").concat(fastestTime.format('HH:mm:ss')));
|
|
184
239
|
|
|
185
240
|
// 如果只有一个最快可用的资源,直接返回
|
|
186
|
-
if (fastestResources.length === 1)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
var maxIdleTime = 0;
|
|
190
|
-
var selectedResource = null;
|
|
191
|
-
for (var _i2 = 0, _fastestResources = fastestResources; _i2 < _fastestResources.length; _i2++) {
|
|
192
|
-
var resource = _fastestResources[_i2];
|
|
193
|
-
var idleTime = calculateResourceAvailableTime({
|
|
194
|
-
resource: resource,
|
|
195
|
-
timeSlots: {
|
|
196
|
-
start_time: fastestTime.format('HH:mm'),
|
|
197
|
-
end_time: fastestTime.format('HH:mm'),
|
|
198
|
-
start_at: fastestTime,
|
|
199
|
-
end_at: fastestTime
|
|
200
|
-
},
|
|
201
|
-
currentCapacity: (countMap[resource.id] || 0) + currentCapacity
|
|
202
|
-
});
|
|
203
|
-
if (idleTime > maxIdleTime) {
|
|
204
|
-
maxIdleTime = idleTime;
|
|
205
|
-
selectedResource = resource;
|
|
206
|
-
}
|
|
241
|
+
if (fastestResources.length === 1) {
|
|
242
|
+
console.log("[TimeslotUtils] \u8FD4\u56DE\u552F\u4E00\u6700\u5FEB\u8D44\u6E90: ".concat(fastestResources[0].main_field));
|
|
243
|
+
return fastestResources[0];
|
|
207
244
|
}
|
|
245
|
+
|
|
246
|
+
// 如果有多个最快可用的资源,选择第一个或根据其他逻辑选择
|
|
247
|
+
// 这里简化处理,直接返回第一个
|
|
248
|
+
var selectedResource = fastestResources[0];
|
|
249
|
+
console.log("[TimeslotUtils] \u8FD4\u56DE\u591A\u4E2A\u8D44\u6E90\u4E2D\u7684\u7B2C\u4E00\u4E2A: ".concat(selectedResource.main_field));
|
|
208
250
|
return selectedResource;
|
|
209
251
|
}
|
|
210
252
|
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -40,6 +40,9 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
40
40
|
quantity: number;
|
|
41
41
|
selling_price: number;
|
|
42
42
|
}[];
|
|
43
|
+
initWalletData(params?: {
|
|
44
|
+
order_wait_pay_amount: number;
|
|
45
|
+
}): Promise<void>;
|
|
43
46
|
/**
|
|
44
47
|
* 创建本地订单 (前端模拟下单流程)
|
|
45
48
|
*
|
|
@@ -95,6 +98,10 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
95
98
|
* 强制重新从服务器获取支付方式列表,更新本地缓存
|
|
96
99
|
*/
|
|
97
100
|
refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
101
|
+
/**
|
|
102
|
+
* 获取订单原始数据
|
|
103
|
+
*/
|
|
104
|
+
getOrderOriginalData(): any;
|
|
98
105
|
/**
|
|
99
106
|
* 获取当前订单基础信息
|
|
100
107
|
*
|
|
@@ -411,5 +418,19 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
411
418
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
412
419
|
cover?: boolean;
|
|
413
420
|
}): Promise<void>;
|
|
421
|
+
/**
|
|
422
|
+
* 通过订单ID编辑订单备注
|
|
423
|
+
*
|
|
424
|
+
* 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
|
|
425
|
+
*
|
|
426
|
+
* @param orderId 后端订单ID
|
|
427
|
+
* @param note 新的订单备注
|
|
428
|
+
* @returns 修改结果
|
|
429
|
+
*/
|
|
430
|
+
editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
|
|
431
|
+
success: boolean;
|
|
432
|
+
message?: string;
|
|
433
|
+
orderId?: string | number;
|
|
434
|
+
}>;
|
|
414
435
|
destroy(): Promise<void>;
|
|
415
436
|
}
|