@pisell/pisellos 1.0.65 → 1.0.67

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.
Files changed (43) hide show
  1. package/dist/modules/Date/index.js +4 -0
  2. package/dist/modules/Order/index.js +10 -4
  3. package/dist/modules/Payment/index.d.ts +1 -0
  4. package/dist/modules/Payment/index.js +75 -41
  5. package/dist/modules/Payment/walletpass.js +3 -4
  6. package/dist/modules/Rules/index.js +2 -0
  7. package/dist/modules/Schedule/index.d.ts +1 -1
  8. package/dist/modules/Schedule/index.js +9 -0
  9. package/dist/solution/BookingByStep/index.d.ts +16 -4
  10. package/dist/solution/BookingByStep/index.js +671 -109
  11. package/dist/solution/BookingByStep/utils/capacity.d.ts +23 -0
  12. package/dist/solution/BookingByStep/utils/capacity.js +219 -1
  13. package/dist/solution/BookingByStep/utils/stock.d.ts +29 -0
  14. package/dist/solution/BookingByStep/utils/stock.js +126 -0
  15. package/dist/solution/BookingTicket/index.d.ts +1 -1
  16. package/dist/solution/Checkout/index.d.ts +6 -148
  17. package/dist/solution/Checkout/index.js +1188 -2434
  18. package/dist/solution/Checkout/types.d.ts +7 -220
  19. package/dist/solution/Checkout/types.js +1 -49
  20. package/dist/solution/Checkout/utils/index.d.ts +9 -5
  21. package/dist/solution/Checkout/utils/index.js +18 -56
  22. package/lib/modules/Date/index.js +3 -0
  23. package/lib/modules/Order/index.js +6 -0
  24. package/lib/modules/Payment/index.d.ts +1 -0
  25. package/lib/modules/Payment/index.js +35 -8
  26. package/lib/modules/Payment/walletpass.js +2 -2
  27. package/lib/modules/Rules/index.js +2 -0
  28. package/lib/modules/Schedule/index.d.ts +1 -1
  29. package/lib/modules/Schedule/index.js +9 -0
  30. package/lib/solution/BookingByStep/index.d.ts +16 -4
  31. package/lib/solution/BookingByStep/index.js +363 -8
  32. package/lib/solution/BookingByStep/utils/capacity.d.ts +23 -0
  33. package/lib/solution/BookingByStep/utils/capacity.js +157 -0
  34. package/lib/solution/BookingByStep/utils/stock.d.ts +29 -0
  35. package/lib/solution/BookingByStep/utils/stock.js +89 -0
  36. package/lib/solution/BookingTicket/index.d.ts +1 -1
  37. package/lib/solution/Checkout/index.d.ts +6 -148
  38. package/lib/solution/Checkout/index.js +337 -1115
  39. package/lib/solution/Checkout/types.d.ts +7 -220
  40. package/lib/solution/Checkout/types.js +3 -27
  41. package/lib/solution/Checkout/utils/index.d.ts +9 -5
  42. package/lib/solution/Checkout/utils/index.js +12 -53
  43. package/package.json +1 -1
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,18 +16,30 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/solution/BookingByStep/utils/capacity.ts
20
30
  var capacity_exports = {};
21
31
  __export(capacity_exports, {
32
+ calculateCartItemsCapacityUsageByResourceType: () => calculateCartItemsCapacityUsageByResourceType,
22
33
  checkResourceCanUseByCapacity: () => checkResourceCanUseByCapacity,
23
34
  checkSubResourcesCapacity: () => checkSubResourcesCapacity,
35
+ checkTimeSlotCapacity: () => checkTimeSlotCapacity,
24
36
  formatDefaultCapacitys: () => formatDefaultCapacitys,
25
37
  getCapacityInfoByCartItem: () => getCapacityInfoByCartItem,
38
+ getResourcesIdsByProduct: () => getResourcesIdsByProduct,
26
39
  getSumCapacity: () => getSumCapacity
27
40
  });
28
41
  module.exports = __toCommonJS(capacity_exports);
42
+ var import_dayjs = __toESM(require("dayjs"));
29
43
  var formatDefaultCapacitys = ({
30
44
  capacity,
31
45
  product_bundle
@@ -96,11 +110,154 @@ var checkResourceCanUseByCapacity = (currentCapacity, requiredCapacity, maxCapac
96
110
  }
97
111
  return currentCapacity + requiredCapacity <= maxCapacity;
98
112
  };
113
+ function calculateCartItemsCapacityUsageByResourceType({
114
+ cartItems,
115
+ timeSlotStart,
116
+ timeSlotEnd,
117
+ allProductResources
118
+ }) {
119
+ const resourceTypeMap = {};
120
+ allProductResources.forEach((resource) => {
121
+ var _a;
122
+ const formId = ((_a = resource.form_id) == null ? void 0 : _a.toString()) || "default";
123
+ if (!resourceTypeMap[formId]) {
124
+ resourceTypeMap[formId] = [];
125
+ }
126
+ resourceTypeMap[formId].push(resource);
127
+ });
128
+ const capacityUsageByType = {};
129
+ Object.keys(resourceTypeMap).forEach((formId) => {
130
+ let totalUsage = 0;
131
+ const resourcesInThisType = resourceTypeMap[formId];
132
+ const resourceIdsInThisType = resourcesInThisType.map((r) => r.id);
133
+ cartItems.forEach((cartItem) => {
134
+ if (!cartItem.start_time || !cartItem.end_time)
135
+ return;
136
+ const itemStart = `${cartItem.start_date} ${cartItem.start_time}`;
137
+ const itemEnd = `${cartItem.end_date || cartItem.start_date} ${cartItem.end_time}`;
138
+ const hasTimeOverlap = !((0, import_dayjs.default)(itemEnd).isBefore((0, import_dayjs.default)(timeSlotStart)) || (0, import_dayjs.default)(itemStart).isAfter((0, import_dayjs.default)(timeSlotEnd)));
139
+ if (!hasTimeOverlap)
140
+ return;
141
+ const productResourceIds = getResourcesIdsByProduct(cartItem._productOrigin);
142
+ const hasResourceTypeOverlap = productResourceIds.some(
143
+ (id) => resourceIdsInThisType.includes(id)
144
+ );
145
+ if (!hasResourceTypeOverlap)
146
+ return;
147
+ const { currentCapacity } = getCapacityInfoByCartItem(cartItem);
148
+ totalUsage += currentCapacity;
149
+ });
150
+ capacityUsageByType[formId] = totalUsage;
151
+ });
152
+ return capacityUsageByType;
153
+ }
154
+ function getResourcesIdsByProduct(product) {
155
+ var _a, _b, _c;
156
+ const tempResourceIds = [];
157
+ (_c = (_b = (_a = product == null ? void 0 : product.product_resource) == null ? void 0 : _a.resources) == null ? void 0 : _b.forEach) == null ? void 0 : _c.call(_b, (resource) => {
158
+ var _a2, _b2;
159
+ if ((resource == null ? void 0 : resource.status) == 1) {
160
+ if ((_a2 = resource == null ? void 0 : resource.default_resource) == null ? void 0 : _a2.length) {
161
+ tempResourceIds.push(...resource == null ? void 0 : resource.default_resource);
162
+ } else if ((_b2 = resource == null ? void 0 : resource.optional_resource) == null ? void 0 : _b2.length) {
163
+ tempResourceIds.push(...resource == null ? void 0 : resource.optional_resource);
164
+ }
165
+ }
166
+ });
167
+ return tempResourceIds;
168
+ }
169
+ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResources) {
170
+ var _a, _b;
171
+ const resourceTypeMap = {};
172
+ allResources.forEach((resource) => {
173
+ var _a2;
174
+ const formId = ((_a2 = resource.form_id) == null ? void 0 : _a2.toString()) || "default";
175
+ if (!resourceTypeMap[formId]) {
176
+ resourceTypeMap[formId] = [];
177
+ }
178
+ resourceTypeMap[formId].push(resource);
179
+ });
180
+ const requiredCapacityByType = {};
181
+ cartItems.forEach((cartItem) => {
182
+ const productResourceIds = getResourcesIdsByProduct(cartItem._productOrigin);
183
+ const { currentCapacity } = getCapacityInfoByCartItem(cartItem);
184
+ Object.keys(resourceTypeMap).forEach((formId) => {
185
+ const resourcesInType = resourceTypeMap[formId];
186
+ const resourceIdsInType = resourcesInType.map((r) => r.id);
187
+ const needsThisResourceType = productResourceIds.some(
188
+ (id) => resourceIdsInType.includes(id)
189
+ );
190
+ if (needsThisResourceType) {
191
+ requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
192
+ }
193
+ });
194
+ });
195
+ for (const [formId, requiredCapacity] of Object.entries(requiredCapacityByType)) {
196
+ const resourcesInType = resourceTypeMap[formId];
197
+ if (resourcesInType.length === 0)
198
+ continue;
199
+ let resourceTypeConfig = null;
200
+ for (const cartItem of cartItems) {
201
+ if ((_b = (_a = cartItem._productOrigin) == null ? void 0 : _a.product_resource) == null ? void 0 : _b.resources) {
202
+ resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(
203
+ (r) => {
204
+ var _a2;
205
+ return ((_a2 = r.id) == null ? void 0 : _a2.toString()) === formId && r.status === 1;
206
+ }
207
+ );
208
+ if (resourceTypeConfig)
209
+ break;
210
+ }
211
+ }
212
+ const isMultipleBooking = (resourceTypeConfig == null ? void 0 : resourceTypeConfig.type) === "multiple";
213
+ console.log(`capacity.ts - 资源类型 ${formId} 配置:`, {
214
+ resourceTypeConfig,
215
+ type: resourceTypeConfig == null ? void 0 : resourceTypeConfig.type,
216
+ isMultipleBooking,
217
+ requiredCapacity
218
+ });
219
+ if (isMultipleBooking) {
220
+ let totalAvailableCapacity = 0;
221
+ resourcesInType.forEach((resource) => {
222
+ const availableTimes = resource.times.filter((time) => {
223
+ 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");
224
+ });
225
+ if (availableTimes.length > 0) {
226
+ totalAvailableCapacity += resource.capacity || 0;
227
+ }
228
+ });
229
+ console.log(`capacity.ts - 资源类型 ${formId} 多个预约检查: 总容量 ${totalAvailableCapacity}, 需求 ${requiredCapacity}`);
230
+ if (totalAvailableCapacity < requiredCapacity) {
231
+ console.log(`资源类型 ${formId} 容量不足: 需要 ${requiredCapacity}, 可用 ${totalAvailableCapacity}`);
232
+ return false;
233
+ }
234
+ } else {
235
+ let availableResourceCount = 0;
236
+ resourcesInType.forEach((resource) => {
237
+ const availableTimes = resource.times.filter((time) => {
238
+ 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");
239
+ });
240
+ if (availableTimes.length > 0) {
241
+ availableResourceCount++;
242
+ }
243
+ });
244
+ console.log(`capacity.ts - 资源类型 ${formId} 单个预约检查: 可用资源数 ${availableResourceCount}, 需求 ${requiredCapacity}`);
245
+ if (availableResourceCount < requiredCapacity) {
246
+ console.log(`资源类型 ${formId} 数量不足: 需要 ${requiredCapacity}, 可用 ${availableResourceCount}`);
247
+ return false;
248
+ }
249
+ }
250
+ }
251
+ return true;
252
+ }
99
253
  // Annotate the CommonJS export names for ESM import in node:
100
254
  0 && (module.exports = {
255
+ calculateCartItemsCapacityUsageByResourceType,
101
256
  checkResourceCanUseByCapacity,
102
257
  checkSubResourcesCapacity,
258
+ checkTimeSlotCapacity,
103
259
  formatDefaultCapacitys,
104
260
  getCapacityInfoByCartItem,
261
+ getResourcesIdsByProduct,
105
262
  getSumCapacity
106
263
  });
@@ -0,0 +1,29 @@
1
+ import { CartItem } from '../../../modules';
2
+ /**
3
+ * 检测商品库存是否足够
4
+ *
5
+ * 只有同时满足以下条件时才会进行库存检测:
6
+ * - is_track 开启(值为 1 或 true)
7
+ * - over_sold 为 0(不允许超卖)
8
+ *
9
+ * 对于多规格商品:
10
+ * - 如果有 product_variant_id,则从 productData.variant 数组中查找对应规格
11
+ * - 使用规格的 is_track, over_sold, stock_quantity 而不是主商品的
12
+ *
13
+ * @param productData 商品数据(需包含 is_track, over_sold, stock_quantity 字段,多规格商品需包含 variant 数组)
14
+ * @param product_variant_id 商品变体ID,如果存在则为多规格商品
15
+ * @param quantity 需要添加的数量
16
+ * @param bundle 套餐配置(子商品需包含 is_track, over_sold, stock_quantity 字段)
17
+ * @param currentCartItems 当前购物车商品列表
18
+ * @returns 库存检测结果
19
+ */
20
+ export declare function checkProductStock({ productData, product_variant_id, quantity, bundle, currentCartItems }: {
21
+ productData: any;
22
+ product_variant_id?: any;
23
+ quantity: number;
24
+ bundle?: any[];
25
+ currentCartItems: CartItem[];
26
+ }): {
27
+ success: boolean;
28
+ errorCode?: string;
29
+ };
@@ -0,0 +1,89 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/solution/BookingByStep/utils/stock.ts
20
+ var stock_exports = {};
21
+ __export(stock_exports, {
22
+ checkProductStock: () => checkProductStock
23
+ });
24
+ module.exports = __toCommonJS(stock_exports);
25
+ function checkProductStock({
26
+ productData,
27
+ product_variant_id,
28
+ quantity,
29
+ bundle,
30
+ currentCartItems
31
+ }) {
32
+ let mainProductConfig = productData;
33
+ if (product_variant_id && productData.variant && Array.isArray(productData.variant)) {
34
+ const variant = productData.variant.find((v) => v.id === product_variant_id);
35
+ if (variant) {
36
+ mainProductConfig = variant;
37
+ }
38
+ }
39
+ const isMainProductTrackingEnabled = mainProductConfig.is_track === 1 || mainProductConfig.is_track === true;
40
+ const isMainProductOverSoldDisabled = mainProductConfig.over_sold === 0;
41
+ if (isMainProductTrackingEnabled && isMainProductOverSoldDisabled) {
42
+ const existingQuantity = currentCartItems.reduce((total, cartItem) => {
43
+ var _a, _b, _c;
44
+ const isSameProduct = ((_a = cartItem._productOrigin) == null ? void 0 : _a.id) === productData.id;
45
+ const isSameVariant = !product_variant_id && !((_b = cartItem._productOrigin) == null ? void 0 : _b.product_variant_id) || ((_c = cartItem._productOrigin) == null ? void 0 : _c.product_variant_id) === product_variant_id;
46
+ if (isSameProduct && isSameVariant) {
47
+ return total + (cartItem.num || 0);
48
+ }
49
+ return total;
50
+ }, 0);
51
+ const totalQuantity = existingQuantity + quantity;
52
+ const stockQuantity = mainProductConfig.stock_quantity;
53
+ if (stockQuantity !== void 0 && stockQuantity !== null && totalQuantity > stockQuantity) {
54
+ return { success: false, errorCode: "not_enough_stock" };
55
+ }
56
+ }
57
+ if (bundle && Array.isArray(bundle)) {
58
+ for (const bundleItem of bundle) {
59
+ const bundleProductId = bundleItem.bundle_product_id;
60
+ const bundleStockQuantity = bundleItem.stock_quantity;
61
+ const bundleRequiredQuantity = (bundleItem.num || 1) * quantity;
62
+ const isBundleTrackingEnabled = bundleItem.is_track === 1 || bundleItem.is_track === true;
63
+ const isBundleOverSoldDisabled = bundleItem.over_sold === 0;
64
+ if (!isBundleTrackingEnabled || !isBundleOverSoldDisabled)
65
+ continue;
66
+ if (bundleStockQuantity === void 0 || bundleStockQuantity === null)
67
+ continue;
68
+ const existingBundleQuantity = currentCartItems.reduce((total, cartItem) => {
69
+ if (!cartItem._bundleOrigin || !Array.isArray(cartItem._bundleOrigin))
70
+ return total;
71
+ cartItem._bundleOrigin.forEach((cartBundleItem) => {
72
+ if (cartBundleItem.bundle_product_id === bundleProductId) {
73
+ total += (cartBundleItem.num || 1) * (cartItem.num || 1);
74
+ }
75
+ });
76
+ return total;
77
+ }, 0);
78
+ const totalBundleQuantity = existingBundleQuantity + bundleRequiredQuantity;
79
+ if (totalBundleQuantity > bundleStockQuantity) {
80
+ return { success: false, errorCode: "not_enough_stock" };
81
+ }
82
+ }
83
+ }
84
+ return { success: true };
85
+ }
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ checkProductStock
89
+ });
@@ -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, "num" | "skip">;
114
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
115
115
  /**
116
116
  * 获取客户列表状态(包含滚动加载相关状态)
117
117
  * @returns 客户状态
@@ -2,7 +2,7 @@ import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
3
  import { OrderModule } from '../../modules/Order';
4
4
  import { PaymentModule } from '../../modules/Payment';
5
- import { CheckoutModuleAPI, CheckoutStep, CheckoutInitParams, CreateLocalOrderParams, PlaceOrderParams, CreateOrderParams, ProcessPaymentParams, CheckoutStatusInfo, CheckoutSummary, CurrentOrderInfo, CartSummaryItem, ExtractedAmountInfo, SendCustomerPayLinkParams } from './types';
5
+ import { CheckoutModuleAPI, CheckoutInitParams, CreateLocalOrderParams, CurrentOrderInfo, CartSummaryItem, SendCustomerPayLinkParams } from './types';
6
6
  import { PaymentOrder, PaymentMethod, PaymentItem, PaymentItemInput } from '../../modules/Payment/types';
7
7
  export * from './types';
8
8
  /**
@@ -64,24 +64,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
64
64
  * 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
65
65
  */
66
66
  createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
67
- /**
68
- * 手动下单 (根据虚拟订单生成实际订单)
69
- *
70
- * 使用当前存储的本地订单数据调用 Order 模块创建真实订单
71
- */
72
- placeOrderAsync(params?: PlaceOrderParams): Promise<{
73
- success: boolean;
74
- orderId?: string;
75
- error?: string;
76
- }>;
77
- /**
78
- * 创建订单
79
- */
80
- createOrderAsync(params: CreateOrderParams): Promise<PaymentOrder>;
81
- /**
82
- * 处理支付
83
- */
84
- processPaymentAsync(params: ProcessPaymentParams): Promise<void>;
85
67
  /**
86
68
  * 完成结账
87
69
  */
@@ -89,28 +71,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
89
71
  success: boolean;
90
72
  orderId?: string;
91
73
  }>;
92
- /**
93
- * 取消结账
94
- */
95
- cancelCheckoutAsync(): Promise<void>;
96
- /**
97
- * 获取结账状态
98
- */
99
- getCheckoutStatus(): CheckoutStatusInfo;
100
- /**
101
- * 获取结账摘要
102
- */
103
- getCheckoutSummaryAsync(): Promise<CheckoutSummary>;
104
- /**
105
- * 获取可用支付方式
106
- */
107
- getAvailablePaymentMethodsAsync(): Promise<PaymentMethod[]>;
108
- /**
109
- * 刷新支付方式缓存
110
- *
111
- * 强制重新从服务器获取支付方式列表,更新本地缓存
112
- */
113
- refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
114
74
  /**
115
75
  * 获取订单原始数据
116
76
  */
@@ -127,21 +87,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
127
87
  * 返回当前订单的所有支付项,包括活跃和已撤销的支付项
128
88
  */
129
89
  getCurrentOrderPaymentItemsAsync(): Promise<PaymentItem[]>;
130
- /**
131
- * 验证结账前置条件
132
- */
133
- validateCheckoutAsync(): Promise<{
134
- valid: boolean;
135
- errors: string[];
136
- }>;
137
- /**
138
- * 重试失败的操作
139
- */
140
- retryFailedOperationAsync(): Promise<void>;
141
- /**
142
- * 设置当前步骤
143
- */
144
- setCurrentStep(step: CheckoutStep): void;
145
90
  /**
146
91
  * 获取订单模块
147
92
  */
@@ -181,12 +126,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
181
126
  * @returns 当前系统计算的待付金额
182
127
  */
183
128
  getBalanceDueAmount(): string;
184
- /**
185
- * 刷新 stateAmount 为当前剩余未支付金额
186
- *
187
- * UI 可以调用此方法来主动刷新支付金额状态
188
- */
189
- refreshStateAmountAsync(): Promise<void>;
190
129
  /**
191
130
  * 获取购物车小计数据
192
131
  *
@@ -195,14 +134,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
195
134
  * @returns 购物车小计数据数组,如果没有则返回 null
196
135
  */
197
136
  getCartSummary(): CartSummaryItem[] | null;
198
- /**
199
- * 获取提取的金额详细信息
200
- *
201
- * 从当前的购物车小计数据中提取结构化的金额信息
202
- *
203
- * @returns 提取的金额信息对象,如果没有小计数据则返回 null
204
- */
205
- getExtractedAmountInfo(): ExtractedAmountInfo | null;
206
137
  /**
207
138
  * 获取支付方式列表
208
139
  *
@@ -252,33 +183,15 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
252
183
  */
253
184
  updateOrderDepositStatusAsync(isDeposit: number): Promise<void>;
254
185
  /**
255
- * 更新当前订单的客户信息
186
+ * 手动设置当前订单的定金金额
256
187
  *
257
- * 更新当前订单关联的客户信息,用于标识订单的所属客户
188
+ * 允许手动设置订单的定金金额,通常用于用户自定义定金支付场景
258
189
  *
259
- * @param customer 客户信息 (customer_id 和/或 customer_name)
190
+ * @param depositAmount 定金金额,必须是有效的数字字符串,且不能超过订单总额
260
191
  * @throws 当前没有活跃订单时抛出错误
192
+ * @throws 定金金额格式无效或超过订单总额时抛出错误
261
193
  */
262
- updateOrderCustomerAsync(customer: {
263
- customer_id?: string;
264
- customer_name?: string;
265
- }): Promise<void>;
266
- /**
267
- * 获取当前订单的客户信息
268
- *
269
- * @returns 当前客户信息,如果没有则返回 null
270
- */
271
- getCurrentCustomer(): {
272
- customer_id?: string;
273
- customer_name?: string;
274
- } | null;
275
- /**
276
- * 检查订单是否需要手动同步(异步版本)
277
- *
278
- * 返回订单是否为纯代金券支付且待付金额<=0但未同步的状态
279
- * 从 Payment 模块获取最新的支付项数据
280
- */
281
- needsManualSyncAsync(): Promise<boolean>;
194
+ setDepositAmountAsync(depositAmount: string): Promise<void>;
282
195
  /**
283
196
  * 手动同步订单到后端
284
197
  *
@@ -335,34 +248,12 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
335
248
  orderUuid?: string;
336
249
  response?: any;
337
250
  }>;
338
- /**
339
- * 获取当前商店折扣金额
340
- *
341
- * @returns 当前的商店折扣金额,如果没有则返回0
342
- */
343
- getShopDiscount(): number;
344
- /**
345
- * 更新订单商店折扣
346
- *
347
- * 同时更新cartSummary和localOrderData中的shop_discount值
348
- *
349
- * @param discountAmount 商店折扣金额
350
- */
351
- updateShopDiscountAsync(discountAmount: number): Promise<void>;
352
251
  /**
353
252
  * 更新订单备注
354
253
  *
355
254
  * @param note 订单备注内容
356
255
  */
357
256
  updateOrderNoteAsync(note: string): Promise<void>;
358
- /**
359
- * 设置状态
360
- */
361
- private setStatus;
362
- /**
363
- * 设置步骤
364
- */
365
- private setStep;
366
257
  /**
367
258
  * 处理错误
368
259
  */
@@ -386,14 +277,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
386
277
  * @returns 处理后的支付项(包含找零信息)
387
278
  */
388
279
  private processCashPaymentItem;
389
- /**
390
- * 判断是否为现金支付
391
- *
392
- * @param paymentCode 支付代码
393
- * @param paymentType 支付类型
394
- * @returns 是否为现金支付
395
- */
396
- private isCashPayment;
397
280
  /**
398
281
  * 预加载支付方式(在初始化时调用)
399
282
  */
@@ -426,11 +309,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
426
309
  * 当剩余待付款金额 <= 0 时,触发订单支付完成事件
427
310
  */
428
311
  private checkOrderPaymentCompletion;
429
- /**
430
- * 同步订单到后端
431
- *
432
- * 调用后端 /order/checkout 接口创建真实订单
433
- */
434
312
  /**
435
313
  * 同步订单到后端并返回真实订单ID
436
314
  *
@@ -439,11 +317,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
439
317
  * @returns 包含订单ID、UUID和完整后端响应的对象
440
318
  */
441
319
  private syncOrderToBackendWithReturn;
442
- private syncOrderToBackend;
443
- /**
444
- * 获取状态消息
445
- */
446
- private getStatusMessage;
447
320
  setOtherParams(params: Record<string, any>, { cover }?: {
448
321
  cover?: boolean;
449
322
  }): Promise<void>;
@@ -491,19 +364,4 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
491
364
  * 在创建新订单前调用,确保状态完全干净
492
365
  */
493
366
  private resetStoreStateAsync;
494
- /**
495
- * 手动清理已完成的订单状态(公开方法)
496
- *
497
- * 供UI层调用的公开方法,用于手动清理订单状态
498
- *
499
- * @returns 清理结果
500
- */
501
- clearCompletedOrderAsync(): Promise<{
502
- success: boolean;
503
- message?: string;
504
- clearedOrder?: {
505
- uuid: string;
506
- orderId: string;
507
- } | null;
508
- }>;
509
367
  }