@pisell/pisellos 2.1.100 → 2.1.101
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/effects/index.d.ts +2 -2
- package/dist/modules/Customer/types.d.ts +1 -1
- package/dist/modules/Payment/types.d.ts +7 -7
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/core/index.js +28 -27
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +7 -3
- package/lib/modules/Account/index.js +10 -9
- package/lib/modules/AccountList/index.js +11 -14
- package/lib/modules/BaseModule.js +3 -6
- package/lib/modules/Cart/index.js +9 -14
- package/lib/modules/Cart/utils/cartProduct.js +6 -3
- package/lib/modules/Customer/constants.js +1 -1
- package/lib/modules/Customer/index.js +15 -18
- package/lib/modules/Customer/types.d.ts +1 -1
- package/lib/modules/Date/index.js +6 -10
- package/lib/modules/Date/types.js +0 -1
- package/lib/modules/Discount/index.js +6 -11
- package/lib/modules/Guests/index.js +15 -10
- package/lib/modules/Order/index.js +7 -10
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +73 -84
- package/lib/modules/Payment/types.d.ts +7 -7
- package/lib/modules/Payment/utils.js +6 -3
- package/lib/modules/Payment/walletpass.js +31 -31
- package/lib/modules/Product/index.js +5 -6
- package/lib/modules/ProductList/index.js +3 -5
- package/lib/modules/Resource/index.js +12 -8
- package/lib/modules/Rules/index.js +35 -21
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/lib/modules/Schedule/index.js +5 -8
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +4 -2
- package/lib/modules/Step/index.js +4 -7
- package/lib/modules/Summary/index.js +4 -9
- package/lib/modules/Summary/utils.js +16 -8
- package/lib/plugins/request.js +33 -34
- package/lib/plugins/window.js +113 -101
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +177 -110
- package/lib/solution/BookingByStep/utils/capacity.js +16 -11
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +8 -4
- package/lib/solution/BookingByStep/utils/stock.js +6 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +27 -24
- package/lib/solution/BookingTicket/index.js +14 -19
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.js +1 -3
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +9 -10
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/Checkout/index.js +211 -216
- package/lib/solution/Checkout/utils/index.js +22 -18
- package/lib/solution/RegisterAndLogin/config.js +2 -2
- package/lib/solution/RegisterAndLogin/index.js +110 -114
- package/lib/solution/RegisterAndLogin/utils.js +9 -9
- package/lib/solution/ShopDiscount/index.js +13 -16
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- package/lib/solution/ShopDiscount/utils.js +2 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/task.js +3 -3
- package/lib/utils/watch.d.ts +2 -2
- package/lib/utils/watch.js +7 -5
- package/package.json +17 -16
|
@@ -48,26 +48,26 @@ var import_types = require("../../../modules/Payment/types");
|
|
|
48
48
|
function validateCheckoutData(params) {
|
|
49
49
|
const errors = [];
|
|
50
50
|
if (!params.cartItems || params.cartItems.length === 0) {
|
|
51
|
-
errors.push("
|
|
51
|
+
errors.push("购物车不能为空");
|
|
52
52
|
}
|
|
53
53
|
if (params.cartItems) {
|
|
54
54
|
params.cartItems.forEach((item, index) => {
|
|
55
55
|
if (!item.id) {
|
|
56
|
-
errors.push(
|
|
56
|
+
errors.push(`购物车商品 ${index + 1} 缺少商品ID`);
|
|
57
57
|
}
|
|
58
58
|
if (!item.price || parseFloat(String(item.price)) < 0) {
|
|
59
|
-
errors.push(
|
|
59
|
+
errors.push(`购物车商品 ${index + 1} 价格无效`);
|
|
60
60
|
}
|
|
61
61
|
if (!item.num || item.num <= 0) {
|
|
62
|
-
errors.push(
|
|
62
|
+
errors.push(`购物车商品 ${index + 1} 数量无效`);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
if (params.orderType && !["virtual", "appointment_booking"].includes(params.orderType)) {
|
|
67
|
-
errors.push("
|
|
67
|
+
errors.push("订单类型无效,必须是 virtual 或 appointment_booking");
|
|
68
68
|
}
|
|
69
69
|
if (params.platform && !["pc", "h5"].includes(params.platform)) {
|
|
70
|
-
errors.push("
|
|
70
|
+
errors.push("平台类型无效,必须是 pc 或 h5");
|
|
71
71
|
}
|
|
72
72
|
return {
|
|
73
73
|
valid: errors.length === 0,
|
|
@@ -84,7 +84,8 @@ function createCheckoutError(type, message, details) {
|
|
|
84
84
|
}
|
|
85
85
|
function formatAmount(amount) {
|
|
86
86
|
const numAmount = typeof amount === "string" ? parseFloat(amount) : amount;
|
|
87
|
-
if (isNaN(numAmount))
|
|
87
|
+
if (isNaN(numAmount))
|
|
88
|
+
return "0.00";
|
|
88
89
|
return numAmount.toFixed(2);
|
|
89
90
|
}
|
|
90
91
|
function validateAmount(amount) {
|
|
@@ -164,9 +165,12 @@ async function retry(fn, maxAttempts = 3, delay = 1e3) {
|
|
|
164
165
|
throw lastError;
|
|
165
166
|
}
|
|
166
167
|
function isEmpty(obj) {
|
|
167
|
-
if (obj == null)
|
|
168
|
-
|
|
169
|
-
if (typeof obj === "
|
|
168
|
+
if (obj == null)
|
|
169
|
+
return true;
|
|
170
|
+
if (Array.isArray(obj) || typeof obj === "string")
|
|
171
|
+
return obj.length === 0;
|
|
172
|
+
if (typeof obj === "object")
|
|
173
|
+
return Object.keys(obj).length === 0;
|
|
170
174
|
return false;
|
|
171
175
|
}
|
|
172
176
|
function getErrorMessage(error) {
|
|
@@ -179,7 +183,7 @@ function getErrorMessage(error) {
|
|
|
179
183
|
if (error && typeof error === "object" && "message" in error) {
|
|
180
184
|
return String(error.message);
|
|
181
185
|
}
|
|
182
|
-
return "
|
|
186
|
+
return "未知错误";
|
|
183
187
|
}
|
|
184
188
|
function isProduction() {
|
|
185
189
|
return process.env.NODE_ENV === "production";
|
|
@@ -204,24 +208,24 @@ function validateLocalOrderData(orderData) {
|
|
|
204
208
|
var _a;
|
|
205
209
|
const errors = [];
|
|
206
210
|
if (!orderData.type) {
|
|
207
|
-
errors.push("
|
|
211
|
+
errors.push("订单类型不能为空");
|
|
208
212
|
}
|
|
209
213
|
if (!orderData.platform) {
|
|
210
|
-
errors.push("
|
|
214
|
+
errors.push("平台信息不能为空");
|
|
211
215
|
}
|
|
212
216
|
if ((!orderData.bookings || orderData.bookings.length === 0) && !((_a = orderData == null ? void 0 : orderData.relation_products) == null ? void 0 : _a.length)) {
|
|
213
|
-
errors.push("
|
|
217
|
+
errors.push("预订信息不能为空");
|
|
214
218
|
}
|
|
215
219
|
if (orderData.bookings) {
|
|
216
220
|
orderData.bookings.forEach((booking, index) => {
|
|
217
221
|
if (!booking.product || !booking.product.product_id) {
|
|
218
|
-
errors.push(
|
|
222
|
+
errors.push(`预订项 ${index + 1} 缺少商品信息`);
|
|
219
223
|
}
|
|
220
224
|
if (!booking.start_date) {
|
|
221
|
-
errors.push(
|
|
225
|
+
errors.push(`预订项 ${index + 1} 缺少开始日期`);
|
|
222
226
|
}
|
|
223
227
|
if (!booking.start_time) {
|
|
224
|
-
errors.push(
|
|
228
|
+
errors.push(`预订项 ${index + 1} 缺少开始时间`);
|
|
225
229
|
}
|
|
226
230
|
});
|
|
227
231
|
}
|
|
@@ -284,7 +288,7 @@ function extractAmountFromCartSummary(cartSummary) {
|
|
|
284
288
|
break;
|
|
285
289
|
}
|
|
286
290
|
});
|
|
287
|
-
console.log("[Checkout]
|
|
291
|
+
console.log("[Checkout] 从购物车小计提取金额信息:", {
|
|
288
292
|
totalAmount: result.totalAmount,
|
|
289
293
|
subTotal: result.subTotal,
|
|
290
294
|
taxAmount: result.taxAmount,
|
|
@@ -550,7 +550,7 @@ var ApiCaller = class {
|
|
|
550
550
|
async call(apiName, params, additionalOptions) {
|
|
551
551
|
const apiConfig = this.config[apiName];
|
|
552
552
|
if (!apiConfig) {
|
|
553
|
-
throw new Error(`API
|
|
553
|
+
throw new Error(`API 配置未找到: ${String(apiName)}`);
|
|
554
554
|
}
|
|
555
555
|
const transformedParams = apiConfig.transformParams ? apiConfig.transformParams(params) : params;
|
|
556
556
|
let requestOptions = { ...apiConfig.options, ...additionalOptions };
|
|
@@ -578,7 +578,7 @@ var ApiCaller = class {
|
|
|
578
578
|
response = await this.request.delete(apiConfig.url, requestOptions);
|
|
579
579
|
break;
|
|
580
580
|
default:
|
|
581
|
-
throw new Error(
|
|
581
|
+
throw new Error(`不支持的 HTTP 方法: ${apiConfig.method}`);
|
|
582
582
|
}
|
|
583
583
|
return apiConfig.transformResponse ? apiConfig.transformResponse(response) : response;
|
|
584
584
|
}
|