@pisell/pisellos 3.0.57 → 3.0.58
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.js +1 -2
- package/dist/effects/index.d.ts +3 -4
- package/dist/effects/index.js +6 -15
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Payment/index.d.ts +9 -273
- package/dist/modules/Payment/index.js +109 -2525
- package/dist/modules/Payment/types.d.ts +30 -382
- package/dist/modules/Payment/types.js +14 -116
- package/dist/modules/ProductList/index.d.ts +1 -12
- package/dist/modules/ProductList/index.js +3 -27
- package/dist/modules/Rules/index.js +14 -27
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +1 -9
- package/dist/solution/ShopDiscount/index.js +2 -4
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/dist/types/index.d.ts +1 -3
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -4
- package/lib/effects/index.js +1 -4
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Payment/index.d.ts +9 -273
- package/lib/modules/Payment/index.js +50 -1285
- package/lib/modules/Payment/types.d.ts +30 -382
- package/lib/modules/Payment/types.js +6 -41
- package/lib/modules/ProductList/index.d.ts +1 -12
- package/lib/modules/ProductList/index.js +2 -29
- package/lib/modules/Rules/index.js +12 -20
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +2 -1
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/lib/types/index.d.ts +1 -3
- package/package.json +2 -4
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -697
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/modules/Payment/cash.d.ts +0 -11
- package/dist/modules/Payment/cash.js +0 -78
- package/dist/modules/Payment/eftpos.d.ts +0 -11
- package/dist/modules/Payment/eftpos.js +0 -80
- package/dist/modules/Payment/wallet.d.ts +0 -11
- package/dist/modules/Payment/wallet.js +0 -78
- package/dist/modules/Payment/walletpass.d.ts +0 -0
- package/dist/modules/Payment/walletpass.js +0 -0
- package/dist/plugins/app-types/app/app.d.ts +0 -83
- package/dist/plugins/app-types/app/const.d.ts +0 -4
- package/dist/plugins/app-types/app/index.d.ts +0 -14
- package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/dist/plugins/app-types/config.d.ts +0 -3
- package/dist/plugins/app-types/cookie/index.d.ts +0 -13
- package/dist/plugins/app-types/data/index.d.ts +0 -8
- package/dist/plugins/app-types/history/config.d.ts +0 -24
- package/dist/plugins/app-types/history/index.d.ts +0 -20
- package/dist/plugins/app-types/history/type.d.ts +0 -2
- package/dist/plugins/app-types/hooks/index.d.ts +0 -12
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/dist/plugins/app-types/index.d.ts +0 -6
- package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
- package/dist/plugins/app-types/locales/en.d.ts +0 -3
- package/dist/plugins/app-types/locales/index.d.ts +0 -37
- package/dist/plugins/app-types/locales/original.d.ts +0 -3
- package/dist/plugins/app-types/locales/type.d.ts +0 -19
- package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
- package/dist/plugins/app-types/logger/index.d.ts +0 -122
- package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
- package/dist/plugins/app-types/models/global.d.ts +0 -32
- package/dist/plugins/app-types/models/index.d.ts +0 -45
- package/dist/plugins/app-types/models/type.d.ts +0 -2
- package/dist/plugins/app-types/package.json +0 -15
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
- package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
- package/dist/plugins/app-types/request/cache.d.ts +0 -46
- package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/dist/plugins/app-types/request/config.d.ts +0 -3
- package/dist/plugins/app-types/request/constants.d.ts +0 -2
- package/dist/plugins/app-types/request/index.d.ts +0 -24
- package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/dist/plugins/app-types/request/type.d.ts +0 -41
- package/dist/plugins/app-types/request/utils.d.ts +0 -46
- package/dist/plugins/app-types/routes/config.d.ts +0 -7
- package/dist/plugins/app-types/routes/index.d.ts +0 -28
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
- package/dist/plugins/app-types/socket/constants.d.ts +0 -33
- package/dist/plugins/app-types/socket/events.d.ts +0 -31
- package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/dist/plugins/app-types/socket/index.d.ts +0 -61
- package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
- package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/dist/plugins/app-types/socket/socket.d.ts +0 -129
- package/dist/plugins/app-types/socket/types.d.ts +0 -85
- package/dist/plugins/app-types/storage/index.d.ts +0 -17
- package/dist/plugins/app-types/tasks/index.d.ts +0 -77
- package/dist/plugins/app-types/tasks/type.d.ts +0 -62
- package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/dist/plugins/app-types/type.d.ts +0 -2
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/dist/plugins/app-types/variables/config.d.ts +0 -3
- package/dist/plugins/app-types/variables/index.d.ts +0 -6
- package/dist/plugins/app-types/variables/type.d.ts +0 -2
- package/dist/plugins/app-types/website/index.d.ts +0 -6
- package/dist/plugins/app.d.ts +0 -8
- package/dist/plugins/app.js +0 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -172
- package/dist/solution/BookingTicket/index.js +0 -665
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/Checkout/index.d.ts +0 -181
- package/dist/solution/Checkout/index.js +0 -1596
- package/dist/solution/Checkout/types.d.ts +0 -550
- package/dist/solution/Checkout/types.js +0 -132
- package/dist/solution/Checkout/utils/index.d.ts +0 -73
- package/dist/solution/Checkout/utils/index.js +0 -371
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -440
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/modules/Payment/cash.d.ts +0 -11
- package/lib/modules/Payment/cash.js +0 -51
- package/lib/modules/Payment/eftpos.d.ts +0 -11
- package/lib/modules/Payment/eftpos.js +0 -51
- package/lib/modules/Payment/wallet.d.ts +0 -11
- package/lib/modules/Payment/wallet.js +0 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -0
- package/lib/modules/Payment/walletpass.js +0 -0
- package/lib/plugins/app-types/app/app.d.ts +0 -83
- package/lib/plugins/app-types/app/const.d.ts +0 -4
- package/lib/plugins/app-types/app/index.d.ts +0 -14
- package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/lib/plugins/app-types/config.d.ts +0 -3
- package/lib/plugins/app-types/cookie/index.d.ts +0 -13
- package/lib/plugins/app-types/data/index.d.ts +0 -8
- package/lib/plugins/app-types/history/config.d.ts +0 -24
- package/lib/plugins/app-types/history/index.d.ts +0 -20
- package/lib/plugins/app-types/history/type.d.ts +0 -2
- package/lib/plugins/app-types/hooks/index.d.ts +0 -12
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/lib/plugins/app-types/index.d.ts +0 -6
- package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
- package/lib/plugins/app-types/locales/en.d.ts +0 -3
- package/lib/plugins/app-types/locales/index.d.ts +0 -37
- package/lib/plugins/app-types/locales/original.d.ts +0 -3
- package/lib/plugins/app-types/locales/type.d.ts +0 -19
- package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
- package/lib/plugins/app-types/logger/index.d.ts +0 -122
- package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
- package/lib/plugins/app-types/models/global.d.ts +0 -32
- package/lib/plugins/app-types/models/index.d.ts +0 -45
- package/lib/plugins/app-types/models/type.d.ts +0 -2
- package/lib/plugins/app-types/package.json +0 -15
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
- package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
- package/lib/plugins/app-types/request/cache.d.ts +0 -46
- package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/lib/plugins/app-types/request/config.d.ts +0 -3
- package/lib/plugins/app-types/request/constants.d.ts +0 -2
- package/lib/plugins/app-types/request/index.d.ts +0 -24
- package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/lib/plugins/app-types/request/type.d.ts +0 -41
- package/lib/plugins/app-types/request/utils.d.ts +0 -46
- package/lib/plugins/app-types/routes/config.d.ts +0 -7
- package/lib/plugins/app-types/routes/index.d.ts +0 -28
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
- package/lib/plugins/app-types/socket/constants.d.ts +0 -33
- package/lib/plugins/app-types/socket/events.d.ts +0 -31
- package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/lib/plugins/app-types/socket/index.d.ts +0 -61
- package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
- package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/lib/plugins/app-types/socket/socket.d.ts +0 -129
- package/lib/plugins/app-types/socket/types.d.ts +0 -85
- package/lib/plugins/app-types/storage/index.d.ts +0 -17
- package/lib/plugins/app-types/tasks/index.d.ts +0 -77
- package/lib/plugins/app-types/tasks/type.d.ts +0 -62
- package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/lib/plugins/app-types/type.d.ts +0 -2
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/lib/plugins/app-types/variables/config.d.ts +0 -3
- package/lib/plugins/app-types/variables/index.d.ts +0 -6
- package/lib/plugins/app-types/variables/type.d.ts +0 -2
- package/lib/plugins/app-types/website/index.d.ts +0 -6
- package/lib/plugins/app.d.ts +0 -8
- package/lib/plugins/app.js +0 -17
- package/lib/solution/BookingTicket/index.d.ts +0 -172
- package/lib/solution/BookingTicket/index.js +0 -399
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/index.d.ts +0 -181
- package/lib/solution/Checkout/index.js +0 -864
- package/lib/solution/Checkout/types.d.ts +0 -550
- package/lib/solution/Checkout/types.js +0 -75
- package/lib/solution/Checkout/utils/index.d.ts +0 -73
- package/lib/solution/Checkout/utils/index.js +0 -266
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
|
@@ -28,7 +28,6 @@ import { RulesHooks } from "./types";
|
|
|
28
28
|
import { uniqueById } from "../../solution/ShopDiscount/utils";
|
|
29
29
|
import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
|
|
30
30
|
import Decimal from 'decimal.js';
|
|
31
|
-
import { isBoolean } from 'lodash-es';
|
|
32
31
|
export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
33
32
|
_inherits(RulesModule, _BaseModule);
|
|
34
33
|
var _super = _createSuper(RulesModule);
|
|
@@ -297,25 +296,19 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
297
296
|
|
|
298
297
|
// 记录可抵扣的商品详情
|
|
299
298
|
var applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
300
|
-
|
|
301
|
-
var productData = {
|
|
299
|
+
applicableProducts.push({
|
|
302
300
|
amount: product.price,
|
|
303
|
-
type:
|
|
304
|
-
tag:
|
|
301
|
+
type: discount.tag || discount.type,
|
|
302
|
+
tag: discount.tag || discount.type,
|
|
305
303
|
discount: {
|
|
306
304
|
resource_id: discount.id,
|
|
307
305
|
title: discount.format_title,
|
|
308
306
|
original_amount: product.origin_total,
|
|
309
307
|
pre_value: discount.par_value,
|
|
310
308
|
product_id: originProduct.id
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
// 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
|
|
315
|
-
if (discountType !== 'good_pass') {
|
|
316
|
-
productData.num = product.num || 1;
|
|
317
|
-
}
|
|
318
|
-
applicableProducts.push(productData);
|
|
309
|
+
},
|
|
310
|
+
num: product.num || 1
|
|
311
|
+
});
|
|
319
312
|
discountApplicableProducts.set(discount.id, applicableProducts);
|
|
320
313
|
}
|
|
321
314
|
});
|
|
@@ -337,10 +330,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
337
330
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
338
331
|
var _product$discount_lis6;
|
|
339
332
|
// 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
|
|
340
|
-
//
|
|
341
|
-
if ((Number(product.price)
|
|
342
|
-
//
|
|
343
|
-
if ((Number(product.total)
|
|
333
|
+
// 商品券时主商品价格为0不可用
|
|
334
|
+
if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
|
|
335
|
+
// 折扣卡时总价为0时不可用
|
|
336
|
+
if ((Number(product.total) === 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
|
|
344
337
|
var _n$discount;
|
|
345
338
|
return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
|
|
346
339
|
})) && (discount.tag || discount.type) !== 'good_pass') return false;
|
|
@@ -380,8 +373,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
380
373
|
}
|
|
381
374
|
|
|
382
375
|
// 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
|
|
383
|
-
|
|
384
|
-
if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
376
|
+
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
385
377
|
if (product.isClient) {
|
|
386
378
|
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
|
|
387
379
|
origin_total: getProductOriginTotalPrice({
|
|
@@ -457,23 +449,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
457
449
|
|
|
458
450
|
// 计算使用折扣卡/商品券以后,单个商品的总 total
|
|
459
451
|
var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(productOriginTotal).minus(new Decimal(product.price || 0)).toNumber() : new Decimal(100).minus(_selectedDiscount.par_value || 0).div(100).mul(new Decimal(productOriginTotal)).toNumber();
|
|
460
|
-
var discountType = _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag;
|
|
461
452
|
var discountDetail = {
|
|
462
453
|
amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
|
|
463
|
-
type:
|
|
454
|
+
type: _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag,
|
|
464
455
|
discount: {
|
|
465
456
|
resource_id: _selectedDiscount.id,
|
|
466
457
|
title: _selectedDiscount.format_title,
|
|
467
458
|
original_amount: productOriginTotal,
|
|
468
459
|
product_id: originProduct.id,
|
|
469
460
|
percent: _selectedDiscount.par_value
|
|
470
|
-
}
|
|
461
|
+
},
|
|
462
|
+
num: product.num || 1
|
|
471
463
|
};
|
|
472
|
-
|
|
473
|
-
// 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
|
|
474
|
-
if ((_selectedDiscount.tag || _selectedDiscount.type) !== 'good_pass') {
|
|
475
|
-
discountDetail.num = product.num || 1;
|
|
476
|
-
}
|
|
477
464
|
appliedProducts.push(discountDetail);
|
|
478
465
|
appliedDiscountProducts.set(_selectedDiscount.id, appliedProducts);
|
|
479
466
|
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/plugins/window.d.ts
CHANGED
|
@@ -112,7 +112,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
112
112
|
this.otherData = ((_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 || (_data$this$otherParam = _data$this$otherParam[this.name]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam['otherData']) || {};
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
moduleArr = ['accountList', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order'];
|
|
115
|
+
moduleArr = ['accountList', 'cart', 'schedule', 'summary', 'step', 'products', 'date', 'order', 'payment'];
|
|
116
116
|
moduleArr.forEach(function (step) {
|
|
117
117
|
var targetModule = createModule(step, _this2.name);
|
|
118
118
|
if (targetModule) {
|
|
@@ -1213,14 +1213,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1213
1213
|
_this6.store.cart.removeItem(n._id);
|
|
1214
1214
|
});
|
|
1215
1215
|
}
|
|
1216
|
-
// // 如果 date.startTime 和 dateRange 里的 startTime 不一样,需要修正 dateRange
|
|
1217
|
-
// const dateRange = this.store.date.getDateRange()
|
|
1218
|
-
// if (dateRange?.[0] && !dayjs(dateRange[0].date).isSame(dayjs(date.startTime), 'day')) {
|
|
1219
|
-
// this.setDateRange([
|
|
1220
|
-
// { date: dayjs(date.startTime).format('YYYY-MM-DD'), status: 'available', week: '', weekNum: 0 },
|
|
1221
|
-
// { date: dayjs(date.endTime).format('YYYY-MM-DD'), status: 'available', week: '', weekNum: 0 },
|
|
1222
|
-
// ]);
|
|
1223
|
-
// }
|
|
1224
1216
|
}
|
|
1225
1217
|
}
|
|
1226
1218
|
}, {
|
|
@@ -29,7 +29,6 @@ import { ShopDiscountHooks } from "./types";
|
|
|
29
29
|
import { DiscountModule } from "../../modules/Discount";
|
|
30
30
|
import { RulesModule } from "../../modules/Rules";
|
|
31
31
|
import Decimal from 'decimal.js';
|
|
32
|
-
import { isBoolean } from 'lodash-es';
|
|
33
32
|
export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
34
33
|
_inherits(ShopDiscountImpl, _BaseModule);
|
|
35
34
|
var _super = _createSuper(ShopDiscountImpl);
|
|
@@ -496,9 +495,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
496
495
|
return n.id === id;
|
|
497
496
|
});
|
|
498
497
|
var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
|
|
499
|
-
// 如果 product.total
|
|
500
|
-
|
|
501
|
-
return Number(product === null || product === void 0 ? void 0 : product.total) <= 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) <= 0 || !(product !== null && product !== void 0 && product.origin_total)) || isBoolean(product === null || product === void 0 ? void 0 : product.vouchersApplicable) && !(product !== null && product !== void 0 && product.vouchersApplicable);
|
|
498
|
+
// 如果 product.total 是 0有可能是她已经用过商品券或者折扣卡导致的 0,所以此时还需要判断 origin_total 是否为 0
|
|
499
|
+
return Number(product === null || product === void 0 ? void 0 : product.total) === 0 && (Number(product === null || product === void 0 ? void 0 : product.origin_total) === 0 || !(product !== null && product !== void 0 && product.origin_total));
|
|
502
500
|
};
|
|
503
501
|
var allUsedProductIds = newDiscountList.map(function (n) {
|
|
504
502
|
var _n$appliedProductDeta;
|
package/dist/solution/index.d.ts
CHANGED
package/dist/solution/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -38,9 +38,7 @@ export interface PisellCore {
|
|
|
38
38
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
39
39
|
hasModule: (name: string) => boolean;
|
|
40
40
|
effects: {
|
|
41
|
-
on: (event: string, callback: (payload: any) => void) =>
|
|
42
|
-
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
|
-
off: (event: string, callback: (payload: any) => void) => void;
|
|
41
|
+
on: (event: string, callback: (payload: any) => void) => void;
|
|
44
42
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
45
43
|
status: boolean;
|
|
46
44
|
data: any;
|
package/lib/core/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var PisellOSCore = class {
|
|
|
61
61
|
console.log(`${prefix} ${message}`);
|
|
62
62
|
break;
|
|
63
63
|
case "warn":
|
|
64
|
-
console.
|
|
64
|
+
console.warn(`${prefix} ${message}`);
|
|
65
65
|
break;
|
|
66
66
|
case "error":
|
|
67
67
|
console.error(`${prefix} ${message}`);
|
package/lib/effects/index.d.ts
CHANGED
|
@@ -2,17 +2,16 @@ type EffectCallback = (payload: any) => void | Promise<void | {
|
|
|
2
2
|
status: boolean;
|
|
3
3
|
message?: string;
|
|
4
4
|
}>;
|
|
5
|
-
type UnsubscribeFunction = () => void;
|
|
6
5
|
declare class EffectsManager {
|
|
7
6
|
private listeners;
|
|
8
|
-
on(event: string, callback: EffectCallback):
|
|
7
|
+
on(event: string, callback: EffectCallback): void;
|
|
9
8
|
off(event: string, callback: EffectCallback): void;
|
|
10
9
|
offByModuleDestroy(module: string): void;
|
|
11
|
-
once(event: string, callback: EffectCallback):
|
|
10
|
+
once(event: string, callback: EffectCallback): void;
|
|
12
11
|
emit(event: string, payload: any): Promise<{
|
|
13
12
|
status: boolean;
|
|
14
13
|
data: any;
|
|
15
14
|
}>;
|
|
16
15
|
clear(): void;
|
|
17
16
|
}
|
|
18
|
-
export { EffectsManager
|
|
17
|
+
export { EffectsManager };
|
package/lib/effects/index.js
CHANGED
|
@@ -31,9 +31,6 @@ var EffectsManager = class {
|
|
|
31
31
|
if (!this.listeners.has(event))
|
|
32
32
|
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
33
33
|
(_a = this.listeners.get(event)) == null ? void 0 : _a.add(callback);
|
|
34
|
-
return () => {
|
|
35
|
-
this.off(event, callback);
|
|
36
|
-
};
|
|
37
34
|
}
|
|
38
35
|
off(event, callback) {
|
|
39
36
|
var _a;
|
|
@@ -52,7 +49,7 @@ var EffectsManager = class {
|
|
|
52
49
|
await callback(payload);
|
|
53
50
|
this.off(event, wrapper);
|
|
54
51
|
};
|
|
55
|
-
|
|
52
|
+
this.on(event, wrapper);
|
|
56
53
|
}
|
|
57
54
|
async emit(event, payload) {
|
|
58
55
|
const callbacks = this.listeners.get(event);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { AccountModule, Account } from '../Account';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
|
-
import { IFetchHolderAccountsParams, IHolder
|
|
4
|
+
import { IFetchHolderAccountsParams, IHolder } from './types';
|
|
5
5
|
export declare class AccountListModule extends BaseModule implements Module {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
@@ -37,12 +37,6 @@ export declare class AccountListModule extends BaseModule implements Module {
|
|
|
37
37
|
customerId: number;
|
|
38
38
|
type?: 'unshift' | 'push';
|
|
39
39
|
}): Promise<AccountModule[]>;
|
|
40
|
-
/**
|
|
41
|
-
* 获取客户列表
|
|
42
|
-
* @param params 查询参数
|
|
43
|
-
* @returns 客户列表
|
|
44
|
-
*/
|
|
45
|
-
getCustomerList(params?: IGetCustomerListParams): Promise<any>;
|
|
46
40
|
/**
|
|
47
41
|
* 获取holder类型账户列表
|
|
48
42
|
* @param params
|
|
@@ -288,33 +288,6 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
|
288
288
|
);
|
|
289
289
|
return accountModules;
|
|
290
290
|
}
|
|
291
|
-
/**
|
|
292
|
-
* 获取客户列表
|
|
293
|
-
* @param params 查询参数
|
|
294
|
-
* @returns 客户列表
|
|
295
|
-
*/
|
|
296
|
-
async getCustomerList(params = {}) {
|
|
297
|
-
const url = "/customer/es/data";
|
|
298
|
-
const { page = 1, pageSize = 20, keyword, ...otherParams } = params;
|
|
299
|
-
try {
|
|
300
|
-
this.store.isLoading = true;
|
|
301
|
-
this.store.error = null;
|
|
302
|
-
const queryParams = {
|
|
303
|
-
page,
|
|
304
|
-
pageSize,
|
|
305
|
-
...keyword && { keyword },
|
|
306
|
-
...otherParams
|
|
307
|
-
};
|
|
308
|
-
const res = await this.request.get(url, queryParams);
|
|
309
|
-
return (res == null ? void 0 : res.data) || [];
|
|
310
|
-
} catch (error) {
|
|
311
|
-
console.error("Failed to fetch customer list:", error);
|
|
312
|
-
this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
|
|
313
|
-
throw error;
|
|
314
|
-
} finally {
|
|
315
|
-
this.store.isLoading = false;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
291
|
/**
|
|
319
292
|
* 获取holder类型账户列表
|
|
320
293
|
* @param params
|
|
@@ -67,31 +67,3 @@ export interface IHolder {
|
|
|
67
67
|
main_field: string;
|
|
68
68
|
customer_cover?: string;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* 获取客户列表参数
|
|
72
|
-
*/
|
|
73
|
-
export interface IGetCustomerListParams {
|
|
74
|
-
/** 页码 */
|
|
75
|
-
page?: number;
|
|
76
|
-
/** 每页数量 */
|
|
77
|
-
pageSize?: number;
|
|
78
|
-
/** 搜索关键词 */
|
|
79
|
-
keyword?: string;
|
|
80
|
-
/** 其他筛选参数 */
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 客户数据
|
|
85
|
-
*/
|
|
86
|
-
export interface ICustomer {
|
|
87
|
-
/** 客户ID */
|
|
88
|
-
id: string | number;
|
|
89
|
-
/** 客户姓名 */
|
|
90
|
-
name: string;
|
|
91
|
-
/** 客户电话 */
|
|
92
|
-
phone?: string;
|
|
93
|
-
/** 客户邮箱 */
|
|
94
|
-
email?: string;
|
|
95
|
-
/** 其他客户信息 */
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
}
|
|
@@ -31,7 +31,7 @@ var import_utils2 = require("../Product/utils");
|
|
|
31
31
|
__reExport(Cart_exports, require("./types"), module.exports);
|
|
32
32
|
var CartModule = class extends import_BaseModule.BaseModule {
|
|
33
33
|
constructor(name, version) {
|
|
34
|
-
super(name
|
|
34
|
+
super(name, version);
|
|
35
35
|
// 提供给 baseModule 用的默认名称 和 默认版本
|
|
36
36
|
this.defaultName = "cart";
|
|
37
37
|
this.defaultVersion = "1.0.0";
|
|
@@ -1,280 +1,16 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { PaymentModuleAPI, PaymentMethod,
|
|
4
|
-
export * from './types';
|
|
5
|
-
export { generateRequestUniqueId };
|
|
6
|
-
/**
|
|
7
|
-
* 生成请求唯一ID
|
|
8
|
-
* 格式: 年月日时分秒毫秒+4位随机数
|
|
9
|
-
* 示例: 20241201143025123456
|
|
10
|
-
*/
|
|
11
|
-
declare function generateRequestUniqueId(): string;
|
|
12
|
-
/**
|
|
13
|
-
* 支付模块实现
|
|
14
|
-
*
|
|
15
|
-
* 支付流程说明:
|
|
16
|
-
* 1. 用户操作 → 调用支付API (pushPaymentAsync, submitPayAsync等)
|
|
17
|
-
* 2. 数据处理 → 更新本地IndexDB中的订单和支付项数据
|
|
18
|
-
* 3. 立即完成 → 本地订单状态立即更新为PaymentStatus.Finished(isSynced保持false)
|
|
19
|
-
* 4. 后台同步 → 网络请求推送到TasksManager异步同步到服务器
|
|
20
|
-
* 5. 同步成功 → 网络请求成功后,isSynced设为true
|
|
21
|
-
* 6. 自动重试 → TasksManager自动重试失败的网络请求,直到isSynced为true
|
|
22
|
-
*
|
|
23
|
-
* 数据状态说明:
|
|
24
|
-
* - PaymentStatus.Processing: 订单正在进行支付操作
|
|
25
|
-
* - PaymentStatus.PartiallyPaid + isSynced=false: 部分支付完成,等待服务器同步
|
|
26
|
-
* - PaymentStatus.PartiallyPaid + isSynced=true: 部分支付且已同步到服务器
|
|
27
|
-
* - PaymentStatus.Finished + isSynced=false: 本地支付完成,等待服务器同步
|
|
28
|
-
* - PaymentStatus.Finished + isSynced=true: 支付完成且已同步到服务器
|
|
29
|
-
*
|
|
30
|
-
* 这种设计的优势:
|
|
31
|
-
* - 即时反馈:支付操作后立即显示完成状态,用户体验更佳
|
|
32
|
-
* - 离线支持:即使网络断开也能正常操作,数据保存在本地
|
|
33
|
-
* - 同步追踪:通过isSynced清楚知道哪些数据还未同步到服务器
|
|
34
|
-
* - 自动重试:TasksManager会自动重试失败的网络请求
|
|
35
|
-
* - 异步处理:不阻塞用户界面,网络同步在后台进行
|
|
36
|
-
* - 数据一致性:通过事件系统确保数据状态同步
|
|
37
|
-
*/
|
|
3
|
+
import { Payment, PaymentModuleAPI, PaymentMethod, PaymentStatus } from './types';
|
|
38
4
|
export declare class PaymentModule extends BaseModule implements Module, PaymentModuleAPI {
|
|
39
5
|
protected defaultName: string;
|
|
40
6
|
protected defaultVersion: string;
|
|
41
|
-
private
|
|
42
|
-
private app;
|
|
43
|
-
private store;
|
|
44
|
-
private dbManager;
|
|
45
|
-
private logger;
|
|
46
|
-
cash: CashPayment;
|
|
47
|
-
eftpos: EftposPayment;
|
|
48
|
-
wallet: WalletPayment;
|
|
7
|
+
private state;
|
|
49
8
|
constructor(name?: string, version?: string);
|
|
50
|
-
initialize(core: PisellCore, options
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*/
|
|
58
|
-
private logWarning;
|
|
59
|
-
/**
|
|
60
|
-
* 记录错误日志
|
|
61
|
-
*/
|
|
62
|
-
private logError;
|
|
63
|
-
/**
|
|
64
|
-
* 记录调试日志
|
|
65
|
-
*/
|
|
66
|
-
private logDebug;
|
|
67
|
-
/**
|
|
68
|
-
* 网络恢复以后,尝试执行队列
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
private registerNetworkHandlers;
|
|
72
|
-
/**
|
|
73
|
-
* 获取支付方式列表
|
|
74
|
-
*/
|
|
75
|
-
getPayMethodListAsync(): Promise<PaymentMethod[]>;
|
|
76
|
-
/**
|
|
77
|
-
* 后台刷新支付方式列表
|
|
78
|
-
*/
|
|
79
|
-
private refreshPaymentMethodsInBackground;
|
|
80
|
-
/**
|
|
81
|
-
* 检查支付方式列表是否有变化
|
|
82
|
-
*/
|
|
83
|
-
private hasPaymentMethodsChanged;
|
|
84
|
-
/**
|
|
85
|
-
* 获取订单列表
|
|
86
|
-
*/
|
|
87
|
-
getOrderListAsync(): Promise<PaymentOrder[]>;
|
|
88
|
-
/**
|
|
89
|
-
* 根据订单UUID获取支付订单(新方法)
|
|
90
|
-
*/
|
|
91
|
-
getPaymentOrderByUuidAsync(orderUuid: string): Promise<PaymentOrder | null>;
|
|
92
|
-
/**
|
|
93
|
-
* 创建支付订单(新方法,专注支付数据)
|
|
94
|
-
*/
|
|
95
|
-
createPaymentOrderAsync(params: PushOrderParams): Promise<PaymentOrder>;
|
|
96
|
-
/**
|
|
97
|
-
* 往交易组中添加订单(兼容性方法)
|
|
98
|
-
* @deprecated 使用 createPaymentOrderAsync 替代
|
|
99
|
-
*/
|
|
100
|
-
pushOrderAsync(params: PushOrderParams): Promise<PaymentOrder>;
|
|
101
|
-
/**
|
|
102
|
-
* 删除支付订单(新方法)
|
|
103
|
-
*/
|
|
104
|
-
deletePaymentOrderAsync(orderUuid: string): Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* 删除订单(兼容性方法)
|
|
107
|
-
* @deprecated 使用 deletePaymentOrderAsync 替代
|
|
108
|
-
*/
|
|
109
|
-
deleteOrderAsync(orderUuid: string): Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* 更新订单
|
|
112
|
-
*/
|
|
113
|
-
updateOrderAsync(orderUuid: string, params: Partial<PaymentOrder>): Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* 基于UUID替换订单ID
|
|
116
|
-
*
|
|
117
|
-
* 此方法用于将本地虚拟订单ID替换为真实的订单ID。
|
|
118
|
-
* 当前端模拟下单流程完成后,后端返回真实订单ID时调用此方法。
|
|
119
|
-
*
|
|
120
|
-
* @param orderUuid 订单的UUID
|
|
121
|
-
* @param newOrderId 新的订单ID (来自后端)
|
|
122
|
-
* @returns 更新后的订单对象,如果订单不存在则返回null
|
|
123
|
-
*/
|
|
124
|
-
replaceOrderIdByUuidAsync(orderUuid: string, newOrderId: string): Promise<PaymentOrder | null>;
|
|
125
|
-
/**
|
|
126
|
-
* 获取支付项(新方法)
|
|
127
|
-
*/
|
|
128
|
-
getPaymentItemsAsync(orderUuid: string): Promise<PaymentItem[]>;
|
|
129
|
-
/**
|
|
130
|
-
* 获取支付项(兼容性方法)
|
|
131
|
-
* @deprecated 使用 getPaymentItemsAsync 替代
|
|
132
|
-
*/
|
|
133
|
-
getPaymentAsync(orderUuid: string): Promise<PaymentItem[]>;
|
|
134
|
-
/**
|
|
135
|
-
* 为某个订单添加支付项(新方法)
|
|
136
|
-
*/
|
|
137
|
-
addPaymentItemAsync(orderUuid: string, paymentItem: PaymentItemInput): Promise<void>;
|
|
138
|
-
/**
|
|
139
|
-
* 为某个订单设置一个支付项(兼容性方法)
|
|
140
|
-
* @deprecated 使用 addPaymentItemAsync 替代
|
|
141
|
-
*/
|
|
142
|
-
pushPaymentAsync(orderUuid: string, paymentItem: PaymentItemInput): Promise<void>;
|
|
143
|
-
/**
|
|
144
|
-
* 删除一个支付项
|
|
145
|
-
*/
|
|
146
|
-
deletePaymentAsync(orderUuid: string, paymentUuid: string): Promise<void>;
|
|
147
|
-
/**
|
|
148
|
-
* 更新一个支付项
|
|
149
|
-
*/
|
|
150
|
-
updatePaymentAsync(orderUuid: string, paymentUuid: string, params: PaymentUpdateFields): Promise<void>;
|
|
151
|
-
/**
|
|
152
|
-
* 提交支付
|
|
153
|
-
*/
|
|
154
|
-
submitPayAsync(orderUuid?: string): Promise<{
|
|
155
|
-
status: 'success' | 'failed';
|
|
156
|
-
}>;
|
|
157
|
-
/**
|
|
158
|
-
* 提交单个订单的支付(推送到任务队列)
|
|
159
|
-
*/
|
|
160
|
-
private submitSingleOrderPayment;
|
|
161
|
-
/**
|
|
162
|
-
* 添加到同步任务队列
|
|
163
|
-
*/
|
|
164
|
-
private addToSyncQueue;
|
|
165
|
-
/**
|
|
166
|
-
* 获取订单剩余待付金额
|
|
167
|
-
*/
|
|
168
|
-
getRemainingOrderAmountAsync(orderUuid: string): Promise<number>;
|
|
169
|
-
/**
|
|
170
|
-
* 在比如现金支付界面的地方,用户输入了一个金额,在下方显示剩余多少金额,通过此方法获取
|
|
171
|
-
*/
|
|
172
|
-
getRemainingOrderAmountWithInputAsync(inputAmount: string | number, orderUuid: string): Promise<number>;
|
|
173
|
-
/**
|
|
174
|
-
* 重新计算订单金额
|
|
175
|
-
*/
|
|
176
|
-
private recalculateOrderAmount;
|
|
177
|
-
/**
|
|
178
|
-
* 获取现金支付方式
|
|
179
|
-
*/
|
|
180
|
-
getCashPaymentMethod(): Promise<PaymentMethod | null>;
|
|
181
|
-
/**
|
|
182
|
-
* 获取Eftpos支付方式
|
|
183
|
-
*/
|
|
184
|
-
getEftposPaymentMethod(): Promise<PaymentMethod | null>;
|
|
185
|
-
/**
|
|
186
|
-
* 获取钱包支付方式
|
|
187
|
-
*/
|
|
188
|
-
getWalletPaymentMethod(): Promise<PaymentMethod | null>;
|
|
189
|
-
/**
|
|
190
|
-
* 注册任务处理函数
|
|
191
|
-
*/
|
|
192
|
-
private registerTaskHandlers;
|
|
193
|
-
/**
|
|
194
|
-
* 静态方法:处理支付同步任务(后台网络同步)
|
|
195
|
-
* 这个方法里不允许用 this,因为需要作为静态方法注入到任务队列里
|
|
196
|
-
*/
|
|
197
|
-
static syncPaymentTask(payload: any): Promise<any>;
|
|
198
|
-
/**
|
|
199
|
-
* 确保支付模块所需的数据库表已创建
|
|
200
|
-
*/
|
|
201
|
-
private ensurePaymentTables;
|
|
202
|
-
/**
|
|
203
|
-
* 获取部分支付的订单
|
|
204
|
-
*/
|
|
205
|
-
getPartiallyPaidOrdersAsync(): Promise<PaymentOrder[]>;
|
|
206
|
-
/**
|
|
207
|
-
* 获取未同步到服务器的订单
|
|
208
|
-
*/
|
|
209
|
-
getUnsyncedOrdersAsync(): Promise<PaymentOrder[]>;
|
|
210
|
-
/**
|
|
211
|
-
* 清理已完成且已同步的订单
|
|
212
|
-
* 注意:只清理完全支付的订单,部分支付的订单保留以便继续支付
|
|
213
|
-
*/
|
|
214
|
-
cleanupFinishedOrders(): Promise<void>;
|
|
215
|
-
/**
|
|
216
|
-
* 检测未同步的订单并重新加入任务队列
|
|
217
|
-
*
|
|
218
|
-
* 此方法专门用于处理因网络问题导致任务队列执行失败但队列被清空的情况。
|
|
219
|
-
* 它会检查本地 IndexDB 中所有未同步的订单(isSynced: false),
|
|
220
|
-
* 并将这些订单重新添加到任务队列中。
|
|
221
|
-
*
|
|
222
|
-
* 使用场景:
|
|
223
|
-
* - 网络恢复后重新检查未同步的订单
|
|
224
|
-
* - 应用启动时检查并重新排队未完成的支付
|
|
225
|
-
* - 用户手动重试前的预检查
|
|
226
|
-
*
|
|
227
|
-
* @returns Promise<number> 返回重新加入队列的订单数量
|
|
228
|
-
*/
|
|
229
|
-
recheckAndRequeueUnsyncedOrders(): Promise<number>;
|
|
230
|
-
/**
|
|
231
|
-
* 手动执行支付同步队列
|
|
232
|
-
* 外部可以调用此方法来触发支付同步任务的执行
|
|
233
|
-
*
|
|
234
|
-
* 注意:此方法只执行现有队列中的任务,不会检查未同步的订单。
|
|
235
|
-
* 如果需要检查未同步订单,请先调用 recheckAndRequeueUnsyncedOrders()
|
|
236
|
-
*
|
|
237
|
-
* 使用示例:
|
|
238
|
-
* ```typescript
|
|
239
|
-
* // 1. 先检查并重新排队未同步订单,然后执行队列
|
|
240
|
-
* const requeuedCount = await paymentModule.recheckAndRequeueUnsyncedOrders();
|
|
241
|
-
* if (requeuedCount > 0) {
|
|
242
|
-
* await paymentModule.runPaymentSyncQueue();
|
|
243
|
-
* }
|
|
244
|
-
*
|
|
245
|
-
* // 2. 或者直接执行现有队列(不检查未同步订单)
|
|
246
|
-
* await paymentModule.runPaymentSyncQueue();
|
|
247
|
-
* ```
|
|
248
|
-
*/
|
|
249
|
-
runPaymentSyncQueue(): Promise<void>;
|
|
250
|
-
/**
|
|
251
|
-
* 重新将订单添加到同步队列
|
|
252
|
-
* 用于处理因网络问题导致任务队列清空但订单未同步的情况
|
|
253
|
-
*
|
|
254
|
-
* @param order 要重新添加的订单
|
|
255
|
-
* @returns Promise<boolean> 是否成功添加到队列
|
|
256
|
-
*/
|
|
257
|
-
private reAddOrderToSyncQueue;
|
|
258
|
-
/**
|
|
259
|
-
* 删除支付项(新方法)
|
|
260
|
-
*/
|
|
261
|
-
deletePaymentItemAsync(orderUuid: string, paymentUuid: string): Promise<void>;
|
|
262
|
-
/**
|
|
263
|
-
* 更新支付项(新方法)
|
|
264
|
-
*/
|
|
265
|
-
updatePaymentItemAsync(orderUuid: string, paymentUuid: string, params: PaymentUpdateFields): Promise<void>;
|
|
266
|
-
/**
|
|
267
|
-
* 获取订单剩余待付金额(新方法)
|
|
268
|
-
*/
|
|
269
|
-
getRemainingAmountAsync(orderUuid: string): Promise<number>;
|
|
270
|
-
/**
|
|
271
|
-
* 获取订单剩余待付金额(基于用户输入的金额)(新方法)
|
|
272
|
-
*/
|
|
273
|
-
getRemainingAmountWithInputAsync(inputAmount: string | number, orderUuid: string): Promise<number>;
|
|
274
|
-
/**
|
|
275
|
-
* 提交支付(新方法)
|
|
276
|
-
*/
|
|
277
|
-
submitPaymentAsync(orderUuid: string): Promise<{
|
|
278
|
-
status: 'success' | 'failed';
|
|
279
|
-
}>;
|
|
9
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
10
|
+
processPayment(paymentId: string): Promise<void>;
|
|
11
|
+
getPayment(paymentId: string): Promise<Payment>;
|
|
12
|
+
getPaymentHistory(): Promise<Payment[]>;
|
|
13
|
+
refund(paymentId: string): Promise<void>;
|
|
14
|
+
getAvailablePaymentMethods(): PaymentMethod[];
|
|
15
|
+
checkPaymentStatus(paymentId: string): Promise<PaymentStatus>;
|
|
280
16
|
}
|