@pisell/pisellos 2.1.38 → 2.2.1
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/core/index.d.ts +8 -1
- package/dist/core/index.js +116 -42
- package/dist/effects/index.d.ts +1 -0
- package/dist/effects/index.js +29 -6
- package/dist/modules/Account/index.js +2 -3
- package/dist/modules/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Customer/index.js +9 -10
- package/dist/modules/Customer/types.d.ts +2 -2
- package/dist/modules/Customer/types.js +2 -2
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.js +1 -1
- package/dist/modules/Payment/index.js +63 -73
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +19 -0
- package/dist/modules/ProductList/index.js +5 -14
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +152 -0
- package/dist/server/index.js +946 -0
- package/dist/server/modules/index.d.ts +16 -0
- package/dist/server/modules/index.js +21 -0
- package/dist/server/modules/menu/index.d.ts +63 -0
- package/dist/server/modules/menu/index.js +476 -0
- package/dist/server/modules/menu/types.d.ts +68 -0
- package/dist/server/modules/menu/types.js +16 -0
- package/dist/server/modules/products/index.d.ts +141 -0
- package/dist/server/modules/products/index.js +768 -0
- package/dist/server/modules/products/types.d.ts +94 -0
- package/dist/server/modules/products/types.js +43 -0
- package/dist/server/modules/quotation/index.d.ts +47 -0
- package/dist/server/modules/quotation/index.js +367 -0
- package/dist/server/modules/quotation/types.d.ts +50 -0
- package/dist/server/modules/quotation/types.js +20 -0
- package/dist/server/modules/schedule/index.d.ts +62 -0
- package/dist/server/modules/schedule/index.js +431 -0
- package/dist/server/modules/schedule/types.d.ts +1 -0
- package/dist/server/modules/schedule/types.js +2 -0
- package/dist/server/modules/schedule/utils.d.ts +32 -0
- package/dist/server/modules/schedule/utils.js +747 -0
- package/dist/server/types.d.ts +64 -0
- package/dist/server/types.js +1 -0
- package/dist/server/utils/index.d.ts +5 -0
- package/dist/server/utils/index.js +6 -0
- package/dist/server/utils/product.d.ts +18 -0
- package/dist/server/utils/product.js +339 -0
- package/dist/server/utils/schedule.d.ts +14 -0
- package/dist/server/utils/schedule.js +108 -0
- package/dist/server/utils/time.d.ts +18 -0
- package/dist/server/utils/time.js +53 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -17
- package/dist/solution/BookingByStep/index.js +23 -468
- package/dist/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/dist/solution/BookingByStep/utils/capacity.js +8 -24
- package/dist/solution/BookingTicket/index.d.ts +12 -0
- package/dist/solution/BookingTicket/index.js +122 -79
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.d.ts +1 -46
- package/dist/solution/Checkout/index.js +530 -850
- package/dist/solution/ShopDiscount/index.js +9 -10
- package/dist/types/index.d.ts +27 -0
- package/lib/core/index.d.ts +8 -1
- package/lib/core/index.js +48 -1
- package/lib/effects/index.d.ts +1 -0
- package/lib/effects/index.js +13 -0
- package/lib/modules/Account/index.js +2 -3
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Customer/index.js +9 -10
- package/lib/modules/Customer/types.d.ts +2 -2
- package/lib/modules/Customer/types.js +2 -2
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.js +1 -1
- package/lib/modules/Payment/index.js +56 -43
- package/lib/modules/Payment/walletpass.js +3 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +19 -0
- package/lib/modules/ProductList/index.js +4 -13
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +152 -0
- package/lib/server/index.js +555 -0
- package/lib/server/modules/index.d.ts +16 -0
- package/lib/server/modules/index.js +47 -0
- package/lib/server/modules/menu/index.d.ts +63 -0
- package/lib/server/modules/menu/index.js +234 -0
- package/lib/server/modules/menu/types.d.ts +68 -0
- package/lib/server/modules/menu/types.js +33 -0
- package/lib/server/modules/products/index.d.ts +141 -0
- package/lib/server/modules/products/index.js +434 -0
- package/lib/server/modules/products/types.d.ts +94 -0
- package/lib/server/modules/products/types.js +35 -0
- package/lib/server/modules/quotation/index.d.ts +47 -0
- package/lib/server/modules/quotation/index.js +177 -0
- package/lib/server/modules/quotation/types.d.ts +50 -0
- package/lib/server/modules/quotation/types.js +33 -0
- package/lib/server/modules/schedule/index.d.ts +62 -0
- package/lib/server/modules/schedule/index.js +231 -0
- package/lib/server/modules/schedule/types.d.ts +1 -0
- package/lib/server/modules/schedule/types.js +23 -0
- package/lib/server/modules/schedule/utils.d.ts +32 -0
- package/lib/server/modules/schedule/utils.js +451 -0
- package/lib/server/types.d.ts +64 -0
- package/lib/server/types.js +17 -0
- package/lib/server/utils/index.d.ts +5 -0
- package/lib/server/utils/index.js +25 -0
- package/lib/server/utils/product.d.ts +18 -0
- package/lib/server/utils/product.js +262 -0
- package/lib/server/utils/schedule.d.ts +14 -0
- package/lib/server/utils/schedule.js +88 -0
- package/lib/server/utils/time.d.ts +18 -0
- package/lib/server/utils/time.js +70 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -17
- package/lib/solution/BookingByStep/index.js +40 -312
- package/lib/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/lib/solution/BookingByStep/utils/capacity.js +8 -21
- package/lib/solution/BookingTicket/index.d.ts +12 -0
- package/lib/solution/BookingTicket/index.js +25 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.d.ts +1 -46
- package/lib/solution/Checkout/index.js +92 -289
- package/lib/solution/ShopDiscount/index.js +10 -11
- package/lib/types/index.d.ts +27 -0
- package/package.json +2 -2
|
@@ -68,12 +68,12 @@ var formatDefaultCapacitys = ({
|
|
|
68
68
|
}
|
|
69
69
|
return [{ id: 0, value: 1, name: "" }];
|
|
70
70
|
};
|
|
71
|
-
var getSumCapacity = ({ capacity
|
|
71
|
+
var getSumCapacity = ({ capacity }) => {
|
|
72
72
|
let sum = 0;
|
|
73
73
|
for (let item of capacity || []) {
|
|
74
74
|
sum += item.value;
|
|
75
75
|
}
|
|
76
|
-
return sum
|
|
76
|
+
return sum;
|
|
77
77
|
};
|
|
78
78
|
function getCapacityInfoByCartItem(targetCartItem) {
|
|
79
79
|
var _a;
|
|
@@ -81,7 +81,7 @@ function getCapacityInfoByCartItem(targetCartItem) {
|
|
|
81
81
|
capacity: (_a = targetCartItem._productOrigin) == null ? void 0 : _a.capacity,
|
|
82
82
|
product_bundle: targetCartItem._origin.product.product_bundle
|
|
83
83
|
});
|
|
84
|
-
const currentCapacity = getSumCapacity({ capacity: formatCapacity
|
|
84
|
+
const currentCapacity = getSumCapacity({ capacity: formatCapacity });
|
|
85
85
|
return {
|
|
86
86
|
formatCapacity,
|
|
87
87
|
currentCapacity
|
|
@@ -194,7 +194,7 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
194
194
|
);
|
|
195
195
|
if (needsThisResourceType) {
|
|
196
196
|
if (selectType === "single") {
|
|
197
|
-
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) +
|
|
197
|
+
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + 1;
|
|
198
198
|
} else {
|
|
199
199
|
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
|
|
200
200
|
}
|
|
@@ -238,18 +238,13 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
238
238
|
console.log(`capacity.ts - 资源类型 ${formId} 多个预约检查: 总容量 ${totalAvailableCapacity}, 需求 ${requiredCapacity}`);
|
|
239
239
|
if (totalAvailableCapacity < requiredCapacity) {
|
|
240
240
|
console.log(`资源类型 ${formId} 容量不足: 需要 ${requiredCapacity}, 可用 ${totalAvailableCapacity}`);
|
|
241
|
-
return
|
|
242
|
-
success: false,
|
|
243
|
-
required: requiredCapacity,
|
|
244
|
-
available: totalAvailableCapacity
|
|
245
|
-
};
|
|
241
|
+
return false;
|
|
246
242
|
}
|
|
247
243
|
} else {
|
|
248
244
|
let availableResourceCount = 0;
|
|
249
245
|
resourcesInType.forEach((resource) => {
|
|
250
246
|
const availableTimes = resource.times.filter((time) => {
|
|
251
|
-
|
|
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") && ((_a2 = time.event_list) == null ? void 0 : _a2.length) === 0;
|
|
247
|
+
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");
|
|
253
248
|
});
|
|
254
249
|
if (availableTimes.length > 0) {
|
|
255
250
|
availableResourceCount++;
|
|
@@ -258,19 +253,11 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
258
253
|
console.log(`capacity.ts - 资源类型 ${formId} 单个预约检查: 可用资源数 ${availableResourceCount}, 需求 ${requiredCapacity}`);
|
|
259
254
|
if (availableResourceCount < requiredCapacity) {
|
|
260
255
|
console.log(`资源类型 ${formId} 数量不足: 需要 ${requiredCapacity}, 可用 ${availableResourceCount}`);
|
|
261
|
-
return
|
|
262
|
-
success: false,
|
|
263
|
-
required: requiredCapacity,
|
|
264
|
-
available: availableResourceCount
|
|
265
|
-
};
|
|
256
|
+
return false;
|
|
266
257
|
}
|
|
267
258
|
}
|
|
268
259
|
}
|
|
269
|
-
return
|
|
270
|
-
success: true,
|
|
271
|
-
required: 0,
|
|
272
|
-
available: 0
|
|
273
|
-
};
|
|
260
|
+
return true;
|
|
274
261
|
}
|
|
275
262
|
// Annotate the CommonJS export names for ESM import in node:
|
|
276
263
|
0 && (module.exports = {
|
|
@@ -22,11 +22,23 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
22
22
|
* @returns 商品列表
|
|
23
23
|
*/
|
|
24
24
|
loadProducts(params?: ILoadProductsParams): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* 初始化外设扫码结果监听
|
|
27
|
+
*/
|
|
28
|
+
initPeripheralsListener(): void;
|
|
25
29
|
/**
|
|
26
30
|
* 获取商品列表(不加载到模块中)
|
|
27
31
|
* @returns 商品列表
|
|
28
32
|
*/
|
|
29
33
|
getProducts(): Promise<ProductData[]>;
|
|
34
|
+
/**
|
|
35
|
+
* 获取日程时间段点
|
|
36
|
+
* @param params 参数
|
|
37
|
+
* @returns 日程时间段点
|
|
38
|
+
*/
|
|
39
|
+
getScheduleTimePoints(params: {
|
|
40
|
+
menu_list_ids: number[];
|
|
41
|
+
}): Promise<any>;
|
|
30
42
|
/**
|
|
31
43
|
* 获取客户列表
|
|
32
44
|
* @param params 查询参数
|
|
@@ -99,7 +99,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
99
99
|
throw new Error(`模块 ${step} 不存在`);
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
this.core.effects.emit(
|
|
102
|
+
this.core.effects.emit(`${this.name}:onInited`, {});
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* 获取商品列表
|
|
@@ -115,13 +115,19 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
115
115
|
...params,
|
|
116
116
|
cacheId: this.cacheId
|
|
117
117
|
});
|
|
118
|
-
this.core.effects.emit(
|
|
118
|
+
this.core.effects.emit(`${this.name}:onProductsLoaded`, result);
|
|
119
119
|
return result;
|
|
120
120
|
} catch (error) {
|
|
121
121
|
console.error("Failed to load products:", error);
|
|
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 商品列表
|
|
@@ -129,6 +135,19 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
129
135
|
async getProducts() {
|
|
130
136
|
return this.store.products.getProducts();
|
|
131
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* 获取日程时间段点
|
|
140
|
+
* @param params 参数
|
|
141
|
+
* @returns 日程时间段点
|
|
142
|
+
*/
|
|
143
|
+
async getScheduleTimePoints(params) {
|
|
144
|
+
const result = await this.request.post("/menu/schedule-time-points", {
|
|
145
|
+
menu_list_ids: params.menu_list_ids
|
|
146
|
+
}, {
|
|
147
|
+
osServer: true
|
|
148
|
+
});
|
|
149
|
+
return result.data || [];
|
|
150
|
+
}
|
|
132
151
|
/**
|
|
133
152
|
* 获取客户列表
|
|
134
153
|
* @param params 查询参数
|
|
@@ -149,7 +168,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
149
168
|
*/
|
|
150
169
|
setActiveCustomer(customer) {
|
|
151
170
|
this.store.customer.setSelectedCustomer(customer);
|
|
152
|
-
this.core.effects.emit(
|
|
171
|
+
this.core.effects.emit(`${this.name}:onCustomerSelected`, {
|
|
153
172
|
customer
|
|
154
173
|
});
|
|
155
174
|
}
|
|
@@ -168,7 +187,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
168
187
|
const customer = this.store.customer.getCustomerById(customerId);
|
|
169
188
|
if (customer) {
|
|
170
189
|
this.store.customer.setSelectedCustomer(customer);
|
|
171
|
-
this.core.effects.emit(
|
|
190
|
+
this.core.effects.emit(`${this.name}:onCustomerSelected`, {
|
|
172
191
|
customer
|
|
173
192
|
});
|
|
174
193
|
}
|
|
@@ -248,7 +267,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
248
267
|
async loadMoreCustomers() {
|
|
249
268
|
try {
|
|
250
269
|
const result = await this.store.customer.loadMoreCustomers();
|
|
251
|
-
this.core.effects.emit(
|
|
270
|
+
this.core.effects.emit(`${this.name}:onCustomerListUpdate`, result);
|
|
252
271
|
return result;
|
|
253
272
|
} catch (error) {
|
|
254
273
|
console.error("Failed to load more customers:", error);
|
|
@@ -263,7 +282,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
263
282
|
async resetAndLoadCustomers(params = {}) {
|
|
264
283
|
try {
|
|
265
284
|
const result = await this.store.customer.resetAndLoadCustomers(params);
|
|
266
|
-
this.core.effects.emit(
|
|
285
|
+
this.core.effects.emit(`${this.name}:onCustomerListReset`, result);
|
|
267
286
|
return result;
|
|
268
287
|
} catch (error) {
|
|
269
288
|
console.error("Failed to reset and load customers:", error);
|
|
@@ -37,9 +37,15 @@ var import_task = __toESM(require("../../../../utils/task"));
|
|
|
37
37
|
var Scan = class {
|
|
38
38
|
constructor(solution, watchKey) {
|
|
39
39
|
this.listenerConfig = /* @__PURE__ */ new Map();
|
|
40
|
-
var _a, _b, _c, _d, _e;
|
|
41
40
|
this.solution = solution;
|
|
42
41
|
this.watchKey = watchKey;
|
|
42
|
+
this.initPeripheralsListener();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 初始化外设扫码结果监听
|
|
46
|
+
*/
|
|
47
|
+
initPeripheralsListener() {
|
|
48
|
+
var _a, _b, _c, _d, _e;
|
|
43
49
|
(_e = (_d = (_c = (_b = (_a = this.solution) == null ? void 0 : _a.window) == null ? void 0 : _b.interaction) == null ? void 0 : _c.utils) == null ? void 0 : _d.mountFunction) == null ? void 0 : _e.call(
|
|
44
50
|
_d,
|
|
45
51
|
"global",
|
|
@@ -24,7 +24,6 @@ __export(BuyTickets_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(BuyTickets_exports);
|
|
26
26
|
var import_modules = require("../../modules/");
|
|
27
|
-
var import_types = require("./types");
|
|
28
27
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
29
28
|
__reExport(BuyTickets_exports, require("./types"), module.exports);
|
|
30
29
|
var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
@@ -49,7 +48,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
49
48
|
if (this.otherParams.prodctIds) {
|
|
50
49
|
await this.loadProductsByIds(this.otherParams.prodctIds);
|
|
51
50
|
}
|
|
52
|
-
await this.core.effects.emit(
|
|
51
|
+
await this.core.effects.emit(`${this.name}:onInited`, {});
|
|
53
52
|
}
|
|
54
53
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是主商品
|
|
55
54
|
async loadProductsByIds(ids) {
|
|
@@ -69,13 +68,13 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
this.store.mainProducts = mainProducts;
|
|
72
|
-
await this.core.effects.emit(
|
|
71
|
+
await this.core.effects.emit(`${this.name}:onMainProductsLoaded`, {});
|
|
73
72
|
}
|
|
74
73
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是其他商品
|
|
75
74
|
async loadProductsByCategory(categoryId) {
|
|
76
75
|
}
|
|
77
76
|
async destroy() {
|
|
78
|
-
await this.core.effects.emit(
|
|
77
|
+
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
79
78
|
console.log("[BuyTickets] 已销毁");
|
|
80
79
|
}
|
|
81
80
|
// 获取当前绑定的所有商品
|
|
@@ -83,7 +82,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
83
82
|
var _a;
|
|
84
83
|
const mainData = await this.store.mainProducts.getProducts() || [];
|
|
85
84
|
const otherData = await ((_a = this.store.otherProducts) == null ? void 0 : _a.getProducts()) || [];
|
|
86
|
-
await this.core.effects.emit(
|
|
85
|
+
await this.core.effects.emit(`${this.name}:onGetProducts`, [
|
|
87
86
|
...mainData,
|
|
88
87
|
...otherData
|
|
89
88
|
]);
|
|
@@ -102,7 +101,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
102
101
|
}
|
|
103
102
|
// 商品列表页提交
|
|
104
103
|
async listSubmit(data) {
|
|
105
|
-
const res = await this.core.effects.emit(
|
|
104
|
+
const res = await this.core.effects.emit(`${this.name}:onListSubmit`, {
|
|
106
105
|
...data,
|
|
107
106
|
products: this.getProducts()
|
|
108
107
|
});
|
|
@@ -116,14 +115,14 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
116
115
|
}
|
|
117
116
|
// 购物车提交
|
|
118
117
|
async cartSubmit(data) {
|
|
119
|
-
await this.core.effects.emit(
|
|
118
|
+
await this.core.effects.emit(`${this.name}:onCartSubmit`, {
|
|
120
119
|
...data,
|
|
121
120
|
products: this.getProducts()
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
// 结算提交
|
|
125
124
|
async checkoutSubmit(data) {
|
|
126
|
-
await this.core.effects.emit(
|
|
125
|
+
await this.core.effects.emit(`${this.name}:onCheckoutSubmit`, {
|
|
127
126
|
...data,
|
|
128
127
|
products: this.getProducts()
|
|
129
128
|
});
|
|
@@ -19,7 +19,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
19
19
|
private store;
|
|
20
20
|
private otherParams;
|
|
21
21
|
private logger;
|
|
22
|
-
private calculationCache;
|
|
23
22
|
order: OrderModule;
|
|
24
23
|
payment: PaymentModule;
|
|
25
24
|
constructor(name?: string, version?: string);
|
|
@@ -303,46 +302,16 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
303
302
|
* 删除本地 IndexDB 中超过指定天数且已同步到后端的订单数据
|
|
304
303
|
*/
|
|
305
304
|
private cleanupExpiredOrdersAsync;
|
|
306
|
-
/**
|
|
307
|
-
* 清除计算缓存
|
|
308
|
-
*/
|
|
309
|
-
private clearCalculationCache;
|
|
310
|
-
/**
|
|
311
|
-
* 批量获取订单数据(用于性能优化)
|
|
312
|
-
* 一次性获取所有需要的数据,避免重复查询
|
|
313
|
-
*/
|
|
314
|
-
private fetchOrderDataBatch;
|
|
315
|
-
/**
|
|
316
|
-
* 从支付项数组计算已支付金额(纯计算,不查询数据库)
|
|
317
|
-
*/
|
|
318
|
-
private calculatePaidAmountFromItems;
|
|
319
305
|
/**
|
|
320
306
|
* 计算已支付金额(从 Payment 模块获取最新数据)
|
|
321
|
-
*
|
|
322
|
-
* 注意:此方法保持独立性,可以单独调用。
|
|
323
|
-
* 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
|
|
324
307
|
*/
|
|
325
308
|
private calculatePaidAmountAsync;
|
|
326
|
-
/**
|
|
327
|
-
* 从订单和支付项计算剩余金额(纯计算,不查询数据库)
|
|
328
|
-
*/
|
|
329
|
-
private calculateRemainingAmountFromData;
|
|
330
|
-
/**
|
|
331
|
-
* 从订单和支付项计算剩余总金额(纯计算,排除定金)
|
|
332
|
-
*/
|
|
333
|
-
private calculateRemainingTotalAmountFromData;
|
|
334
309
|
/**
|
|
335
310
|
* 计算剩余未支付金额(从 Payment 模块获取最新数据)
|
|
336
|
-
*
|
|
337
|
-
* 注意:此方法保持独立性,可以单独调用。
|
|
338
|
-
* 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
|
|
339
311
|
*/
|
|
340
312
|
private calculateRemainingAmountAsync;
|
|
341
313
|
/**
|
|
342
314
|
* 计算剩余未支付金额(排除定金计算,始终使用订单总金额)
|
|
343
|
-
*
|
|
344
|
-
* 注意:此方法保持独立性,可以单独调用。
|
|
345
|
-
* 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
|
|
346
315
|
*/
|
|
347
316
|
private calculateRemainingTotalAmountAsync;
|
|
348
317
|
/**
|
|
@@ -351,24 +320,12 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
351
320
|
private updateBalanceDueAmount;
|
|
352
321
|
/**
|
|
353
322
|
* 更新 stateAmount 为当前剩余未支付金额
|
|
354
|
-
*
|
|
355
|
-
* 优化版本:批量获取数据,避免重复查询数据库
|
|
356
323
|
*/
|
|
357
324
|
private updateStateAmountToRemaining;
|
|
358
|
-
/**
|
|
359
|
-
* 检查订单支付是否完成(优化版,复用已获取的数据)
|
|
360
|
-
*
|
|
361
|
-
* @param paymentItems 已获取的支付项数据
|
|
362
|
-
* @param remainingAmount 已计算的剩余金额
|
|
363
|
-
*/
|
|
364
|
-
private checkOrderPaymentCompletionOptimized;
|
|
365
325
|
/**
|
|
366
326
|
* 检查订单支付是否完成
|
|
367
327
|
*
|
|
368
328
|
* 当剩余待付款金额 <= 0 时,触发订单支付完成事件
|
|
369
|
-
*
|
|
370
|
-
* 注意:此方法保持独立性,可以单独调用。
|
|
371
|
-
* 在 updateStateAmountToRemaining 中会使用优化版本。
|
|
372
329
|
*/
|
|
373
330
|
private checkOrderPaymentCompletion;
|
|
374
331
|
/**
|
|
@@ -424,8 +381,6 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
424
381
|
* 重置 store 状态
|
|
425
382
|
*
|
|
426
383
|
* 在创建新订单前调用,确保状态完全干净
|
|
427
|
-
*
|
|
428
|
-
* 🚀 性能优化:改为同步方法,事件发射不阻塞主流程
|
|
429
384
|
*/
|
|
430
|
-
private
|
|
385
|
+
private resetStoreStateAsync;
|
|
431
386
|
}
|