@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.
- package/dist/modules/Date/index.js +4 -0
- package/dist/modules/Order/index.js +10 -4
- package/dist/modules/Payment/index.d.ts +1 -0
- package/dist/modules/Payment/index.js +75 -41
- package/dist/modules/Payment/walletpass.js +3 -4
- package/dist/modules/Rules/index.js +2 -0
- package/dist/modules/Schedule/index.d.ts +1 -1
- package/dist/modules/Schedule/index.js +9 -0
- package/dist/solution/BookingByStep/index.d.ts +16 -4
- package/dist/solution/BookingByStep/index.js +671 -109
- package/dist/solution/BookingByStep/utils/capacity.d.ts +23 -0
- package/dist/solution/BookingByStep/utils/capacity.js +219 -1
- package/dist/solution/BookingByStep/utils/stock.d.ts +29 -0
- package/dist/solution/BookingByStep/utils/stock.js +126 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +6 -148
- package/dist/solution/Checkout/index.js +1188 -2434
- package/dist/solution/Checkout/types.d.ts +7 -220
- package/dist/solution/Checkout/types.js +1 -49
- package/dist/solution/Checkout/utils/index.d.ts +9 -5
- package/dist/solution/Checkout/utils/index.js +18 -56
- package/lib/modules/Date/index.js +3 -0
- package/lib/modules/Order/index.js +6 -0
- package/lib/modules/Payment/index.d.ts +1 -0
- package/lib/modules/Payment/index.js +35 -8
- package/lib/modules/Payment/walletpass.js +2 -2
- package/lib/modules/Rules/index.js +2 -0
- package/lib/modules/Schedule/index.d.ts +1 -1
- package/lib/modules/Schedule/index.js +9 -0
- package/lib/solution/BookingByStep/index.d.ts +16 -4
- package/lib/solution/BookingByStep/index.js +363 -8
- package/lib/solution/BookingByStep/utils/capacity.d.ts +23 -0
- package/lib/solution/BookingByStep/utils/capacity.js +157 -0
- package/lib/solution/BookingByStep/utils/stock.d.ts +29 -0
- package/lib/solution/BookingByStep/utils/stock.js +89 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +6 -148
- package/lib/solution/Checkout/index.js +337 -1115
- package/lib/solution/Checkout/types.d.ts +7 -220
- package/lib/solution/Checkout/types.js +3 -27
- package/lib/solution/Checkout/utils/index.d.ts +9 -5
- package/lib/solution/Checkout/utils/index.js +12 -53
- package/package.json +1 -1
|
@@ -45,3 +45,26 @@ export declare const checkSubResourcesCapacity: (resource: ResourceItem) => void
|
|
|
45
45
|
* @returns 如果资源可以容纳额外的容量则返回 true
|
|
46
46
|
*/
|
|
47
47
|
export declare const checkResourceCanUseByCapacity: (currentCapacity: number, requiredCapacity: number, maxCapacity: number) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 计算按资源类型分组的容量占用情况
|
|
50
|
+
*
|
|
51
|
+
* @param {CartItem[]} cartItems 购物车商品列表
|
|
52
|
+
* @param {string} timeSlotStart 时间段开始时间
|
|
53
|
+
* @param {string} timeSlotEnd 时间段结束时间
|
|
54
|
+
* @param {ResourceItem[]} allProductResources 当前商品的所有资源列表
|
|
55
|
+
* @return {Record<string, number>} 返回每种资源类型(form_id)的容量占用
|
|
56
|
+
*/
|
|
57
|
+
export declare function calculateCartItemsCapacityUsageByResourceType({ cartItems, timeSlotStart, timeSlotEnd, allProductResources }: {
|
|
58
|
+
cartItems: CartItem[];
|
|
59
|
+
timeSlotStart: string;
|
|
60
|
+
timeSlotEnd: string;
|
|
61
|
+
allProductResources: ResourceItem[];
|
|
62
|
+
}): Record<string, number>;
|
|
63
|
+
/**
|
|
64
|
+
* 获取商品的资源ID列表
|
|
65
|
+
*/
|
|
66
|
+
export declare function getResourcesIdsByProduct(product: any): number[];
|
|
67
|
+
/**
|
|
68
|
+
* 检查特定时间段的容量是否足够
|
|
69
|
+
*/
|
|
70
|
+
export declare function checkTimeSlotCapacity(timeSlotStart: string, timeSlotEnd: string, cartItems: CartItem[], allResources: ResourceItem[]): boolean;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
4
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
1
9
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3
11
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
import dayjs from 'dayjs';
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* @title: 基于选择的商品格式化容量
|
|
6
16
|
* @description:
|
|
@@ -129,4 +139,212 @@ export var checkResourceCanUseByCapacity = function checkResourceCanUseByCapacit
|
|
|
129
139
|
return false;
|
|
130
140
|
}
|
|
131
141
|
return currentCapacity + requiredCapacity <= maxCapacity;
|
|
132
|
-
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 计算按资源类型分组的容量占用情况
|
|
146
|
+
*
|
|
147
|
+
* @param {CartItem[]} cartItems 购物车商品列表
|
|
148
|
+
* @param {string} timeSlotStart 时间段开始时间
|
|
149
|
+
* @param {string} timeSlotEnd 时间段结束时间
|
|
150
|
+
* @param {ResourceItem[]} allProductResources 当前商品的所有资源列表
|
|
151
|
+
* @return {Record<string, number>} 返回每种资源类型(form_id)的容量占用
|
|
152
|
+
*/
|
|
153
|
+
export function calculateCartItemsCapacityUsageByResourceType(_ref3) {
|
|
154
|
+
var cartItems = _ref3.cartItems,
|
|
155
|
+
timeSlotStart = _ref3.timeSlotStart,
|
|
156
|
+
timeSlotEnd = _ref3.timeSlotEnd,
|
|
157
|
+
allProductResources = _ref3.allProductResources;
|
|
158
|
+
// 按 form_id 分组当前商品的资源
|
|
159
|
+
var resourceTypeMap = {};
|
|
160
|
+
allProductResources.forEach(function (resource) {
|
|
161
|
+
var _resource$form_id;
|
|
162
|
+
var formId = ((_resource$form_id = resource.form_id) === null || _resource$form_id === void 0 ? void 0 : _resource$form_id.toString()) || 'default';
|
|
163
|
+
if (!resourceTypeMap[formId]) {
|
|
164
|
+
resourceTypeMap[formId] = [];
|
|
165
|
+
}
|
|
166
|
+
resourceTypeMap[formId].push(resource);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// 计算每种资源类型的容量占用
|
|
170
|
+
var capacityUsageByType = {};
|
|
171
|
+
Object.keys(resourceTypeMap).forEach(function (formId) {
|
|
172
|
+
var totalUsage = 0;
|
|
173
|
+
var resourcesInThisType = resourceTypeMap[formId];
|
|
174
|
+
var resourceIdsInThisType = resourcesInThisType.map(function (r) {
|
|
175
|
+
return r.id;
|
|
176
|
+
});
|
|
177
|
+
cartItems.forEach(function (cartItem) {
|
|
178
|
+
// 检查该商品是否已经选定了时间
|
|
179
|
+
if (!cartItem.start_time || !cartItem.end_time) return;
|
|
180
|
+
|
|
181
|
+
// 构建该商品的时间段
|
|
182
|
+
var itemStart = "".concat(cartItem.start_date, " ").concat(cartItem.start_time);
|
|
183
|
+
var itemEnd = "".concat(cartItem.end_date || cartItem.start_date, " ").concat(cartItem.end_time);
|
|
184
|
+
|
|
185
|
+
// 检查时间段是否有重叠
|
|
186
|
+
var hasTimeOverlap = !(dayjs(itemEnd).isBefore(dayjs(timeSlotStart)) || dayjs(itemStart).isAfter(dayjs(timeSlotEnd)));
|
|
187
|
+
if (!hasTimeOverlap) return;
|
|
188
|
+
|
|
189
|
+
// 检查该商品的资源配置中是否需要这种类型的资源
|
|
190
|
+
// 由于购物车商品只选定了时间,没有选定具体资源,我们需要看商品的资源配置
|
|
191
|
+
var productResourceIds = getResourcesIdsByProduct(cartItem._productOrigin);
|
|
192
|
+
var hasResourceTypeOverlap = productResourceIds.some(function (id) {
|
|
193
|
+
return resourceIdsInThisType.includes(id);
|
|
194
|
+
});
|
|
195
|
+
if (!hasResourceTypeOverlap) return;
|
|
196
|
+
|
|
197
|
+
// 计算该商品的容量占用
|
|
198
|
+
var _getCapacityInfoByCar = getCapacityInfoByCartItem(cartItem),
|
|
199
|
+
currentCapacity = _getCapacityInfoByCar.currentCapacity;
|
|
200
|
+
totalUsage += currentCapacity;
|
|
201
|
+
});
|
|
202
|
+
capacityUsageByType[formId] = totalUsage;
|
|
203
|
+
});
|
|
204
|
+
return capacityUsageByType;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* 获取商品的资源ID列表
|
|
209
|
+
*/
|
|
210
|
+
export function getResourcesIdsByProduct(product) {
|
|
211
|
+
var _product$product_reso, _product$product_reso2;
|
|
212
|
+
var tempResourceIds = [];
|
|
213
|
+
product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 || (_product$product_reso = _product$product_reso.resources) === null || _product$product_reso === void 0 || (_product$product_reso2 = _product$product_reso.forEach) === null || _product$product_reso2 === void 0 || _product$product_reso2.call(_product$product_reso, function (resource) {
|
|
214
|
+
if ((resource === null || resource === void 0 ? void 0 : resource.status) == 1) {
|
|
215
|
+
var _resource$default_res, _resource$optional_re;
|
|
216
|
+
if (resource !== null && resource !== void 0 && (_resource$default_res = resource.default_resource) !== null && _resource$default_res !== void 0 && _resource$default_res.length) {
|
|
217
|
+
tempResourceIds.push.apply(tempResourceIds, _toConsumableArray(resource === null || resource === void 0 ? void 0 : resource.default_resource));
|
|
218
|
+
} else if (resource !== null && resource !== void 0 && (_resource$optional_re = resource.optional_resource) !== null && _resource$optional_re !== void 0 && _resource$optional_re.length) {
|
|
219
|
+
tempResourceIds.push.apply(tempResourceIds, _toConsumableArray(resource === null || resource === void 0 ? void 0 : resource.optional_resource));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return tempResourceIds;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* 检查特定时间段的容量是否足够
|
|
228
|
+
*/
|
|
229
|
+
export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResources) {
|
|
230
|
+
// 按资源类型分组
|
|
231
|
+
var resourceTypeMap = {};
|
|
232
|
+
allResources.forEach(function (resource) {
|
|
233
|
+
var _resource$form_id2;
|
|
234
|
+
var formId = ((_resource$form_id2 = resource.form_id) === null || _resource$form_id2 === void 0 ? void 0 : _resource$form_id2.toString()) || 'default';
|
|
235
|
+
if (!resourceTypeMap[formId]) {
|
|
236
|
+
resourceTypeMap[formId] = [];
|
|
237
|
+
}
|
|
238
|
+
resourceTypeMap[formId].push(resource);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// 计算每种资源类型需要的总容量
|
|
242
|
+
var requiredCapacityByType = {};
|
|
243
|
+
cartItems.forEach(function (cartItem) {
|
|
244
|
+
var productResourceIds = getResourcesIdsByProduct(cartItem._productOrigin);
|
|
245
|
+
var _getCapacityInfoByCar2 = getCapacityInfoByCartItem(cartItem),
|
|
246
|
+
currentCapacity = _getCapacityInfoByCar2.currentCapacity;
|
|
247
|
+
Object.keys(resourceTypeMap).forEach(function (formId) {
|
|
248
|
+
var resourcesInType = resourceTypeMap[formId];
|
|
249
|
+
var resourceIdsInType = resourcesInType.map(function (r) {
|
|
250
|
+
return r.id;
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// 检查该商品是否需要这种类型的资源
|
|
254
|
+
var needsThisResourceType = productResourceIds.some(function (id) {
|
|
255
|
+
return resourceIdsInType.includes(id);
|
|
256
|
+
});
|
|
257
|
+
if (needsThisResourceType) {
|
|
258
|
+
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// 检查每种资源类型是否有足够的容量
|
|
264
|
+
var _loop = function _loop() {
|
|
265
|
+
var _resourceTypeConfig, _resourceTypeConfig2;
|
|
266
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
267
|
+
formId = _Object$entries$_i[0],
|
|
268
|
+
requiredCapacity = _Object$entries$_i[1];
|
|
269
|
+
var resourcesInType = resourceTypeMap[formId];
|
|
270
|
+
if (resourcesInType.length === 0) return 0; // continue
|
|
271
|
+
|
|
272
|
+
// 从购物车商品中获取正确的资源类型配置
|
|
273
|
+
var resourceTypeConfig = null;
|
|
274
|
+
var _iterator2 = _createForOfIteratorHelper(cartItems),
|
|
275
|
+
_step2;
|
|
276
|
+
try {
|
|
277
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
278
|
+
var _cartItem$_productOri;
|
|
279
|
+
var cartItem = _step2.value;
|
|
280
|
+
if ((_cartItem$_productOri = cartItem._productOrigin) !== null && _cartItem$_productOri !== void 0 && (_cartItem$_productOri = _cartItem$_productOri.product_resource) !== null && _cartItem$_productOri !== void 0 && _cartItem$_productOri.resources) {
|
|
281
|
+
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
282
|
+
var _r$id;
|
|
283
|
+
return ((_r$id = r.id) === null || _r$id === void 0 ? void 0 : _r$id.toString()) === formId && r.status === 1;
|
|
284
|
+
});
|
|
285
|
+
if (resourceTypeConfig) break;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// 确定这种资源类型的预约类型
|
|
290
|
+
} catch (err) {
|
|
291
|
+
_iterator2.e(err);
|
|
292
|
+
} finally {
|
|
293
|
+
_iterator2.f();
|
|
294
|
+
}
|
|
295
|
+
var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
|
|
296
|
+
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u914D\u7F6E:"), {
|
|
297
|
+
resourceTypeConfig: resourceTypeConfig,
|
|
298
|
+
type: (_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type,
|
|
299
|
+
isMultipleBooking: isMultipleBooking,
|
|
300
|
+
requiredCapacity: requiredCapacity
|
|
301
|
+
});
|
|
302
|
+
if (isMultipleBooking) {
|
|
303
|
+
// 多个预约:计算总可用容量
|
|
304
|
+
var totalAvailableCapacity = 0;
|
|
305
|
+
resourcesInType.forEach(function (resource) {
|
|
306
|
+
// 过滤出在时间段内的资源时间片
|
|
307
|
+
var availableTimes = resource.times.filter(function (time) {
|
|
308
|
+
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');
|
|
309
|
+
});
|
|
310
|
+
if (availableTimes.length > 0) {
|
|
311
|
+
// 简化逻辑:如果资源在时间段内有可用时间,就计算其容量
|
|
312
|
+
totalAvailableCapacity += resource.capacity || 0;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u591A\u4E2A\u9884\u7EA6\u68C0\u67E5: \u603B\u5BB9\u91CF ").concat(totalAvailableCapacity, ", \u9700\u6C42 ").concat(requiredCapacity));
|
|
316
|
+
if (totalAvailableCapacity < requiredCapacity) {
|
|
317
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5BB9\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(totalAvailableCapacity));
|
|
318
|
+
return {
|
|
319
|
+
v: false
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
// 单个预约:计算可用资源数量
|
|
324
|
+
var availableResourceCount = 0;
|
|
325
|
+
resourcesInType.forEach(function (resource) {
|
|
326
|
+
// 过滤出在时间段内的资源时间片
|
|
327
|
+
var availableTimes = resource.times.filter(function (time) {
|
|
328
|
+
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');
|
|
329
|
+
});
|
|
330
|
+
if (availableTimes.length > 0) {
|
|
331
|
+
availableResourceCount++;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5355\u4E2A\u9884\u7EA6\u68C0\u67E5: \u53EF\u7528\u8D44\u6E90\u6570 ").concat(availableResourceCount, ", \u9700\u6C42 ").concat(requiredCapacity));
|
|
335
|
+
if (availableResourceCount < requiredCapacity) {
|
|
336
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u6570\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(availableResourceCount));
|
|
337
|
+
return {
|
|
338
|
+
v: false
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
_ret;
|
|
344
|
+
for (var _i = 0, _Object$entries = Object.entries(requiredCapacityByType); _i < _Object$entries.length; _i++) {
|
|
345
|
+
_ret = _loop();
|
|
346
|
+
if (_ret === 0) continue;
|
|
347
|
+
if (_ret) return _ret.v;
|
|
348
|
+
}
|
|
349
|
+
return true;
|
|
350
|
+
}
|
|
@@ -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,126 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
4
|
+
/**
|
|
5
|
+
* 检测商品库存是否足够
|
|
6
|
+
*
|
|
7
|
+
* 只有同时满足以下条件时才会进行库存检测:
|
|
8
|
+
* - is_track 开启(值为 1 或 true)
|
|
9
|
+
* - over_sold 为 0(不允许超卖)
|
|
10
|
+
*
|
|
11
|
+
* 对于多规格商品:
|
|
12
|
+
* - 如果有 product_variant_id,则从 productData.variant 数组中查找对应规格
|
|
13
|
+
* - 使用规格的 is_track, over_sold, stock_quantity 而不是主商品的
|
|
14
|
+
*
|
|
15
|
+
* @param productData 商品数据(需包含 is_track, over_sold, stock_quantity 字段,多规格商品需包含 variant 数组)
|
|
16
|
+
* @param product_variant_id 商品变体ID,如果存在则为多规格商品
|
|
17
|
+
* @param quantity 需要添加的数量
|
|
18
|
+
* @param bundle 套餐配置(子商品需包含 is_track, over_sold, stock_quantity 字段)
|
|
19
|
+
* @param currentCartItems 当前购物车商品列表
|
|
20
|
+
* @returns 库存检测结果
|
|
21
|
+
*/
|
|
22
|
+
export function checkProductStock(_ref) {
|
|
23
|
+
var productData = _ref.productData,
|
|
24
|
+
product_variant_id = _ref.product_variant_id,
|
|
25
|
+
quantity = _ref.quantity,
|
|
26
|
+
bundle = _ref.bundle,
|
|
27
|
+
currentCartItems = _ref.currentCartItems;
|
|
28
|
+
// 1. 检测主商品库存
|
|
29
|
+
// 处理多规格商品:如果有product_variant_id,则从variant数组中查找对应的规格配置
|
|
30
|
+
var mainProductConfig = productData;
|
|
31
|
+
if (product_variant_id && productData.variant && Array.isArray(productData.variant)) {
|
|
32
|
+
var variant = productData.variant.find(function (v) {
|
|
33
|
+
return v.id === product_variant_id;
|
|
34
|
+
});
|
|
35
|
+
if (variant) {
|
|
36
|
+
mainProductConfig = variant; // 使用规格的配置替换主商品配置
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 只有开启库存控制且不允许超卖时才需要检测主商品库存
|
|
41
|
+
var isMainProductTrackingEnabled = mainProductConfig.is_track === 1 || mainProductConfig.is_track === true;
|
|
42
|
+
var isMainProductOverSoldDisabled = mainProductConfig.over_sold === 0;
|
|
43
|
+
if (isMainProductTrackingEnabled && isMainProductOverSoldDisabled) {
|
|
44
|
+
var existingQuantity = currentCartItems.reduce(function (total, cartItem) {
|
|
45
|
+
var _cartItem$_productOri, _cartItem$_productOri2, _cartItem$_productOri3;
|
|
46
|
+
// 检查是否为相同商品(比较商品ID和变体ID)
|
|
47
|
+
var isSameProduct = ((_cartItem$_productOri = cartItem._productOrigin) === null || _cartItem$_productOri === void 0 ? void 0 : _cartItem$_productOri.id) === productData.id;
|
|
48
|
+
var isSameVariant = !product_variant_id && !((_cartItem$_productOri2 = cartItem._productOrigin) !== null && _cartItem$_productOri2 !== void 0 && _cartItem$_productOri2.product_variant_id) || ((_cartItem$_productOri3 = cartItem._productOrigin) === null || _cartItem$_productOri3 === void 0 ? void 0 : _cartItem$_productOri3.product_variant_id) === product_variant_id;
|
|
49
|
+
if (isSameProduct && isSameVariant) {
|
|
50
|
+
return total + (cartItem.num || 0);
|
|
51
|
+
}
|
|
52
|
+
return total;
|
|
53
|
+
}, 0);
|
|
54
|
+
var totalQuantity = existingQuantity + quantity;
|
|
55
|
+
var stockQuantity = mainProductConfig.stock_quantity;
|
|
56
|
+
|
|
57
|
+
// 检查主商品库存是否足够
|
|
58
|
+
if (stockQuantity !== undefined && stockQuantity !== null && totalQuantity > stockQuantity) {
|
|
59
|
+
return {
|
|
60
|
+
success: false,
|
|
61
|
+
errorCode: 'not_enough_stock'
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 2. 检测套餐商品库存
|
|
67
|
+
if (bundle && Array.isArray(bundle)) {
|
|
68
|
+
// 直接遍历套餐商品数组
|
|
69
|
+
var _iterator = _createForOfIteratorHelper(bundle),
|
|
70
|
+
_step;
|
|
71
|
+
try {
|
|
72
|
+
var _loop = function _loop() {
|
|
73
|
+
var bundleItem = _step.value;
|
|
74
|
+
var bundleProductId = bundleItem.bundle_product_id;
|
|
75
|
+
var bundleStockQuantity = bundleItem.stock_quantity;
|
|
76
|
+
var bundleRequiredQuantity = (bundleItem.num || 1) * quantity; // 子商品需求数量 = 子商品配置数量 * 主商品购买数量
|
|
77
|
+
|
|
78
|
+
// 检查套餐子商品是否需要进行库存控制
|
|
79
|
+
var isBundleTrackingEnabled = bundleItem.is_track === 1 || bundleItem.is_track === true;
|
|
80
|
+
var isBundleOverSoldDisabled = bundleItem.over_sold === 0;
|
|
81
|
+
|
|
82
|
+
// 跳过没有开启库存控制或允许超卖的子商品
|
|
83
|
+
if (!isBundleTrackingEnabled || !isBundleOverSoldDisabled) return 0; // continue
|
|
84
|
+
|
|
85
|
+
// 跳过没有库存配置的子商品
|
|
86
|
+
if (bundleStockQuantity === undefined || bundleStockQuantity === null) return 0; // continue
|
|
87
|
+
|
|
88
|
+
// 计算购物车中已有的相同子商品数量
|
|
89
|
+
var existingBundleQuantity = currentCartItems.reduce(function (total, cartItem) {
|
|
90
|
+
// 检查购物车中商品的套餐配置
|
|
91
|
+
if (!cartItem._bundleOrigin || !Array.isArray(cartItem._bundleOrigin)) return total;
|
|
92
|
+
cartItem._bundleOrigin.forEach(function (cartBundleItem) {
|
|
93
|
+
if (cartBundleItem.bundle_product_id === bundleProductId) {
|
|
94
|
+
total += (cartBundleItem.num || 1) * (cartItem.num || 1);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return total;
|
|
98
|
+
}, 0);
|
|
99
|
+
var totalBundleQuantity = existingBundleQuantity + bundleRequiredQuantity;
|
|
100
|
+
|
|
101
|
+
// 检查子商品库存是否足够
|
|
102
|
+
if (totalBundleQuantity > bundleStockQuantity) {
|
|
103
|
+
return {
|
|
104
|
+
v: {
|
|
105
|
+
success: false,
|
|
106
|
+
errorCode: 'not_enough_stock'
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
_ret;
|
|
112
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
113
|
+
_ret = _loop();
|
|
114
|
+
if (_ret === 0) continue;
|
|
115
|
+
if (_ret) return _ret.v;
|
|
116
|
+
}
|
|
117
|
+
} catch (err) {
|
|
118
|
+
_iterator.e(err);
|
|
119
|
+
} finally {
|
|
120
|
+
_iterator.f();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
success: true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -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, "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,
|
|
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
|
|
190
|
+
* @param depositAmount 定金金额,必须是有效的数字字符串,且不能超过订单总额
|
|
260
191
|
* @throws 当前没有活跃订单时抛出错误
|
|
192
|
+
* @throws 定金金额格式无效或超过订单总额时抛出错误
|
|
261
193
|
*/
|
|
262
|
-
|
|
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
|
}
|