@pisell/pisellos 2.3.36 → 2.3.38
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 +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +8 -0
- package/dist/modules/Order/index.js +21 -14
- package/dist/modules/Order/utils.js +2 -1
- package/dist/modules/Payment/index.js +1 -1
- package/dist/modules/Payment/types.d.ts +73 -4
- package/dist/modules/Payment/types.js +18 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +75 -49
- package/dist/server/index.js +28 -24
- package/dist/server/modules/order/index.d.ts +5 -0
- package/dist/server/modules/order/index.js +52 -31
- package/dist/solution/BaseSales/index.d.ts +77 -11
- package/dist/solution/BaseSales/index.js +1476 -434
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +7 -3
- package/dist/solution/BookingTicket/index.js +130 -48
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/ScanOrder/index.js +31 -20
- package/dist/solution/VenueBooking/index.js +30 -19
- package/dist/types/index.d.ts +1 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +5 -0
- package/lib/modules/Order/index.js +10 -4
- package/lib/modules/Order/utils.js +6 -1
- package/lib/modules/Payment/index.js +1 -1
- package/lib/modules/Payment/types.d.ts +73 -4
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +30 -7
- package/lib/server/index.js +11 -8
- package/lib/server/modules/order/index.d.ts +5 -0
- package/lib/server/modules/order/index.js +24 -2
- package/lib/solution/BaseSales/index.d.ts +77 -11
- package/lib/solution/BaseSales/index.js +699 -41
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +7 -3
- package/lib/solution/BookingTicket/index.js +60 -8
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/ScanOrder/index.js +8 -0
- package/lib/solution/VenueBooking/index.js +8 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1572,7 +1572,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1572
1572
|
value: (function () {
|
|
1573
1573
|
var _upsertLocalDraftOrders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(draftOrders) {
|
|
1574
1574
|
var _this10 = this;
|
|
1575
|
-
var draftMap, memoryDraftMap, _iterator8, _step8, order, draftOrder, storageKey, memoryDraftOrder,
|
|
1575
|
+
var draftMap, memoryDraftMap, _iterator8, _step8, order, draftOrder, storageKey, memoryDraftOrder, mergeActions, updatedList, identityKeyToIndex, index, _iterator9, _step9, key, _iterator10, _step10, _step10$value, _storageKey2, _draftOrder, matchIndex, existingOrder, reconciledDraftOrder, mergedOrder, nextOrder, insertIndex, patchedOrders, previousList, removedLegacyMemoryDraft;
|
|
1576
1576
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1577
1577
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1578
1578
|
case 0:
|
|
@@ -1639,7 +1639,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1639
1639
|
memoryDraftCount: memoryDraftMap.size,
|
|
1640
1640
|
sqliteOnlyDraftCount: draftMap.size - memoryDraftMap.size
|
|
1641
1641
|
});
|
|
1642
|
-
patchedOrders = _toConsumableArray(draftMap.values());
|
|
1643
1642
|
mergeActions = {};
|
|
1644
1643
|
updatedList = this.store.list.filter(function (order) {
|
|
1645
1644
|
return _this10.shouldKeepOrderInMemory(order);
|
|
@@ -1659,66 +1658,71 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1659
1658
|
}
|
|
1660
1659
|
}
|
|
1661
1660
|
_iterator10 = _createForOfIteratorHelper(memoryDraftMap.entries());
|
|
1662
|
-
_context13.prev =
|
|
1661
|
+
_context13.prev = 36;
|
|
1663
1662
|
_iterator10.s();
|
|
1664
|
-
case
|
|
1663
|
+
case 38:
|
|
1665
1664
|
if ((_step10 = _iterator10.n()).done) {
|
|
1666
|
-
_context13.next =
|
|
1665
|
+
_context13.next = 57;
|
|
1667
1666
|
break;
|
|
1668
1667
|
}
|
|
1669
1668
|
_step10$value = _slicedToArray(_step10.value, 2), _storageKey2 = _step10$value[0], _draftOrder = _step10$value[1];
|
|
1670
1669
|
matchIndex = this.lookupOrderIndexByIdentityKeys(identityKeyToIndex, this.getOrderIdentityMatchKeys(_draftOrder));
|
|
1671
1670
|
if (!(matchIndex >= 0)) {
|
|
1672
|
-
_context13.next =
|
|
1671
|
+
_context13.next = 51;
|
|
1673
1672
|
break;
|
|
1674
1673
|
}
|
|
1675
|
-
|
|
1674
|
+
existingOrder = updatedList[matchIndex];
|
|
1675
|
+
reconciledDraftOrder = this.preserveExistingBusinessCodeForDraft(existingOrder, _draftOrder);
|
|
1676
|
+
mergedOrder = this.mergeOrderRecords(existingOrder, reconciledDraftOrder);
|
|
1676
1677
|
nextOrder = _objectSpread(_objectSpread({}, mergedOrder), {}, {
|
|
1677
1678
|
need_sync: 0,
|
|
1678
1679
|
is_draft_order: 1
|
|
1679
1680
|
});
|
|
1680
1681
|
updatedList[matchIndex] = nextOrder;
|
|
1682
|
+
// SQLite 必须与内存中的草稿保持同一份 business_code,避免下次 hydrate 再次丢失分类。
|
|
1683
|
+
draftMap.set(_storageKey2, reconciledDraftOrder);
|
|
1681
1684
|
this.registerOrderIdentityKeys(identityKeyToIndex, nextOrder, matchIndex);
|
|
1682
1685
|
mergeActions[_storageKey2] = 'update';
|
|
1683
|
-
return _context13.abrupt("continue",
|
|
1684
|
-
case
|
|
1686
|
+
return _context13.abrupt("continue", 55);
|
|
1687
|
+
case 51:
|
|
1685
1688
|
insertIndex = updatedList.length;
|
|
1686
1689
|
updatedList.push(_draftOrder);
|
|
1687
1690
|
this.registerOrderIdentityKeys(identityKeyToIndex, _draftOrder, insertIndex);
|
|
1688
1691
|
mergeActions[_storageKey2] = 'insert';
|
|
1689
|
-
case 53:
|
|
1690
|
-
_context13.next = 39;
|
|
1691
|
-
break;
|
|
1692
1692
|
case 55:
|
|
1693
|
-
_context13.next =
|
|
1693
|
+
_context13.next = 38;
|
|
1694
1694
|
break;
|
|
1695
1695
|
case 57:
|
|
1696
|
-
_context13.
|
|
1697
|
-
|
|
1696
|
+
_context13.next = 62;
|
|
1697
|
+
break;
|
|
1698
|
+
case 59:
|
|
1699
|
+
_context13.prev = 59;
|
|
1700
|
+
_context13.t1 = _context13["catch"](36);
|
|
1698
1701
|
_iterator10.e(_context13.t1);
|
|
1699
|
-
case
|
|
1700
|
-
_context13.prev =
|
|
1702
|
+
case 62:
|
|
1703
|
+
_context13.prev = 62;
|
|
1701
1704
|
_iterator10.f();
|
|
1702
|
-
return _context13.finish(
|
|
1703
|
-
case
|
|
1705
|
+
return _context13.finish(62);
|
|
1706
|
+
case 65:
|
|
1707
|
+
patchedOrders = _toConsumableArray(draftMap.values());
|
|
1704
1708
|
previousList = this.store.list;
|
|
1705
1709
|
this.store.list = this.runOrderStoreSelfCheck(updatedList, 'upsertLocalDraftOrders.store');
|
|
1706
1710
|
this.syncOrdersMap();
|
|
1707
|
-
_context13.prev =
|
|
1708
|
-
_context13.next =
|
|
1711
|
+
_context13.prev = 69;
|
|
1712
|
+
_context13.next = 72;
|
|
1709
1713
|
return this.patchOrdersInSQLite(patchedOrders, 'upsertLocalDraftOrders', mergeActions, {
|
|
1710
1714
|
throwOnError: true
|
|
1711
1715
|
});
|
|
1712
|
-
case
|
|
1713
|
-
_context13.next =
|
|
1716
|
+
case 72:
|
|
1717
|
+
_context13.next = 79;
|
|
1714
1718
|
break;
|
|
1715
|
-
case
|
|
1716
|
-
_context13.prev =
|
|
1717
|
-
_context13.t2 = _context13["catch"](
|
|
1719
|
+
case 74:
|
|
1720
|
+
_context13.prev = 74;
|
|
1721
|
+
_context13.t2 = _context13["catch"](69);
|
|
1718
1722
|
this.store.list = previousList;
|
|
1719
1723
|
this.syncOrdersMap();
|
|
1720
1724
|
throw _context13.t2;
|
|
1721
|
-
case
|
|
1725
|
+
case 79:
|
|
1722
1726
|
this.logInfo('upsertLocalDraftOrders-结束', {
|
|
1723
1727
|
count: patchedOrders.length,
|
|
1724
1728
|
storeOrderCountAfter: this.store.list.length
|
|
@@ -1727,18 +1731,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1727
1731
|
return !_this10.shouldKeepOrderInMemory(order);
|
|
1728
1732
|
});
|
|
1729
1733
|
if (!(memoryDraftMap.size > 0 || removedLegacyMemoryDraft)) {
|
|
1730
|
-
_context13.next =
|
|
1734
|
+
_context13.next = 84;
|
|
1731
1735
|
break;
|
|
1732
1736
|
}
|
|
1733
|
-
_context13.next =
|
|
1737
|
+
_context13.next = 84;
|
|
1734
1738
|
return this.emitOrdersChanged(patchedOrders.filter(function (order) {
|
|
1735
1739
|
return _this10.shouldKeepOrderInMemory(order);
|
|
1736
1740
|
}), 'upsertLocalDraftOrders');
|
|
1737
|
-
case
|
|
1741
|
+
case 84:
|
|
1738
1742
|
case "end":
|
|
1739
1743
|
return _context13.stop();
|
|
1740
1744
|
}
|
|
1741
|
-
}, _callee13, this, [[6, 21, 24, 27], [
|
|
1745
|
+
}, _callee13, this, [[6, 21, 24, 27], [36, 59, 62, 65], [69, 74]]);
|
|
1742
1746
|
}));
|
|
1743
1747
|
function upsertLocalDraftOrders(_x10) {
|
|
1744
1748
|
return _upsertLocalDraftOrders.apply(this, arguments);
|
|
@@ -1853,6 +1857,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1853
1857
|
value: function isBlankIdentityValue(value) {
|
|
1854
1858
|
return value === undefined || value === null || value === '';
|
|
1855
1859
|
}
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* `/sales/draft` 的旧调用方可能把未设置的 business_code 传成空串。
|
|
1863
|
+
* 对同一真实订单,空值不能覆盖已有的分类,否则 booking 查询会把该订单从 Party 列表过滤掉。
|
|
1864
|
+
*/
|
|
1865
|
+
}, {
|
|
1866
|
+
key: "preserveExistingBusinessCodeForDraft",
|
|
1867
|
+
value: function preserveExistingBusinessCodeForDraft(existingOrder, draftOrder) {
|
|
1868
|
+
var existingBusinessCode = existingOrder.business_code;
|
|
1869
|
+
var draftBusinessCode = draftOrder.business_code;
|
|
1870
|
+
var hasExistingBusinessCode = typeof existingBusinessCode === 'string' && existingBusinessCode.trim() !== '';
|
|
1871
|
+
var hasDraftBusinessCode = typeof draftBusinessCode === 'string' && draftBusinessCode.trim() !== '';
|
|
1872
|
+
if (!hasExistingBusinessCode || hasDraftBusinessCode) return draftOrder;
|
|
1873
|
+
return _objectSpread(_objectSpread({}, draftOrder), {}, {
|
|
1874
|
+
business_code: existingBusinessCode
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1856
1877
|
}, {
|
|
1857
1878
|
key: "getOrderIdentityEntries",
|
|
1858
1879
|
value: function getOrderIdentityEntries(order) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult } from './types';
|
|
3
|
+
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
5
|
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
|
|
6
6
|
import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
|
|
@@ -9,7 +9,7 @@ import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
|
9
9
|
export * from './types';
|
|
10
10
|
import { ProductList } from '../../modules/ProductList';
|
|
11
11
|
import { PaymentModule } from '../../modules/Payment';
|
|
12
|
-
import type { PaymentMethod } from '../../modules/Payment/types';
|
|
12
|
+
import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
|
|
13
13
|
import type { SalesSummaryModule } from '../../modules/SalesSummary';
|
|
14
14
|
import type { ScheduleModule } from '../../modules/Schedule';
|
|
15
15
|
import { QuotationModule } from '../../modules/Quotation';
|
|
@@ -48,6 +48,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
48
48
|
protected store: BaseSalesState;
|
|
49
49
|
protected otherParams: Record<string, any>;
|
|
50
50
|
protected cacheId: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* 由已在初始化阶段解析过设备短号的业务解决方案写入。
|
|
53
|
+
* 未设置时,支付编号仍按原逻辑实时读取设备信息。
|
|
54
|
+
*/
|
|
55
|
+
protected paymentNumberDevicePrefix: string | null;
|
|
51
56
|
/**
|
|
52
57
|
* window / request 暴露为 public:现存外部工具(如 BookingTicket Scan)通过
|
|
53
58
|
* `solution.window` / `solution.request` 直接访问插件,保持原有契约不破坏。
|
|
@@ -64,6 +69,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
64
69
|
private autoPaymentSyncTimer;
|
|
65
70
|
private salesDetailLoadInFlightCount;
|
|
66
71
|
private salesDetailLoadSequence;
|
|
72
|
+
private walletAssetsRefreshSequence;
|
|
67
73
|
private salesDetailHydrateQueue;
|
|
68
74
|
private serverOrderChangeUnsubscribe;
|
|
69
75
|
private serverOrderChangeHydrateInFlight;
|
|
@@ -141,6 +147,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
141
147
|
*/
|
|
142
148
|
protected readSessionCacheData(): Record<string, any>;
|
|
143
149
|
protected getAppData<T>(key: string): T | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* 复用业务解决方案初始化时已解析的支付设备短号。
|
|
152
|
+
* 空值会清除缓存,使后续支付恢复实时读取设备信息的兼容路径。
|
|
153
|
+
*/
|
|
154
|
+
protected setPaymentNumberDevicePrefix(prefix: unknown): void;
|
|
144
155
|
private getPaymentNumberDevicePrefixSync;
|
|
145
156
|
private getPaymentNumberDevicePrefixAsync;
|
|
146
157
|
private syncAppDataToTempOrder;
|
|
@@ -284,7 +295,10 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
284
295
|
* 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
|
|
285
296
|
*/
|
|
286
297
|
addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
|
|
287
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* 创建新支付项时优先使用业务解决方案初始化阶段缓存的设备短号;
|
|
300
|
+
* 未缓存的通用 BaseSales 保持实时读取设备信息的兼容语义。
|
|
301
|
+
*/
|
|
288
302
|
addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
|
|
289
303
|
private addOrderPaymentWithDevicePrefix;
|
|
290
304
|
/** 更新当前订单中的指定支付项。 */
|
|
@@ -301,9 +315,38 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
301
315
|
confirmPendingVoucherPayments(): OrderPaymentData[];
|
|
302
316
|
discardPendingVoucherPayments(): OrderPaymentData[];
|
|
303
317
|
private getWalletProductList;
|
|
318
|
+
private buildWalletInitBusinessData;
|
|
304
319
|
initWalletData(params?: {
|
|
305
320
|
order_wait_pay_amount?: number;
|
|
306
321
|
}): Promise<import("../../modules/Payment").WalletInitializationResult>;
|
|
322
|
+
private getCommittedWalletAssets;
|
|
323
|
+
private publishWalletAssetsState;
|
|
324
|
+
private syncSelectedWalletAssets;
|
|
325
|
+
/** 读取购物车与 Shared Checkout 共用的钱包资产状态。 */
|
|
326
|
+
getWalletAssetsState(): WalletAssetsState;
|
|
327
|
+
/** 导出 Shared Checkout 跨运行时恢复所需的钱包状态与搜索缓存。 */
|
|
328
|
+
exportWalletAssetsSnapshot(): WalletAssetsSnapshot;
|
|
329
|
+
/**
|
|
330
|
+
* 恢复 Shared Checkout 钱包快照,并把选择重新同步为订单 pending payment。
|
|
331
|
+
*/
|
|
332
|
+
importWalletAssetsSnapshot(snapshot: WalletAssetsSnapshot): Promise<WalletAssetsState>;
|
|
333
|
+
/**
|
|
334
|
+
* 基于当前订单快照刷新钱包资产。商品变化保留并重验选择;客户变化强制清空。
|
|
335
|
+
*/
|
|
336
|
+
refreshWalletAssets(params?: {
|
|
337
|
+
order_wait_pay_amount?: number;
|
|
338
|
+
preserveSelection?: boolean;
|
|
339
|
+
}): Promise<WalletAssetsState>;
|
|
340
|
+
/** 选择或取消单张钱包资产,并立即同步 pending wallet payments。 */
|
|
341
|
+
selectWalletAsset(params: {
|
|
342
|
+
assetId: WalletAssetId;
|
|
343
|
+
selected: boolean;
|
|
344
|
+
source?: WalletAssetSelectionSource;
|
|
345
|
+
}): Promise<WalletAssetsState>;
|
|
346
|
+
/** 扫码精确查券;仅可用资产会被自动选中。 */
|
|
347
|
+
scanWalletAsset(code: string): Promise<ScanWalletAssetResult>;
|
|
348
|
+
/** 清空全部未确认钱包选择,已支付钱包项由 Order 模块继续保留。 */
|
|
349
|
+
clearWalletAssetSelection(): Promise<WalletAssetsState>;
|
|
307
350
|
/**
|
|
308
351
|
* 更新当前订单客户字段。
|
|
309
352
|
*
|
|
@@ -320,16 +363,39 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
320
363
|
getPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
321
364
|
/** 同步读取初始化时缓存的支付方式列表。 */
|
|
322
365
|
getPaymentMethods(): PaymentMethod[];
|
|
323
|
-
|
|
366
|
+
private findCashPaymentMethod;
|
|
367
|
+
private getPendingWalletPaymentAmount;
|
|
368
|
+
/** 读取现金 action 所需的支付方式、待付金额和快捷金额。 */
|
|
369
|
+
getCashPaymentConfig(): Promise<BaseSalesCashPaymentConfig>;
|
|
370
|
+
/**
|
|
371
|
+
* 确认足额覆盖订单的 pending Wallet 支付并提交订单。
|
|
372
|
+
*
|
|
373
|
+
* Order 模块在构造提交参数时将 pending voucher 转为 paid;只有提交成功后
|
|
374
|
+
* 才同步 Wallet committed 状态。失败时恢复调用前 payments,允许用户重试。
|
|
375
|
+
*/
|
|
376
|
+
confirmWalletPayment<T = Record<string, any>>(): Promise<BaseSalesConfirmWalletPaymentResult<T>>;
|
|
377
|
+
/**
|
|
378
|
+
* 购物车现金直付:写入现金记录并等待支付同步完成。
|
|
379
|
+
* 同步失败会恢复调用前 payments(包含 Wallet pending 状态)。
|
|
380
|
+
*/
|
|
381
|
+
payCash(params: BaseSalesPayCashParams): Promise<BaseSalesPayCashResult>;
|
|
382
|
+
/**
|
|
383
|
+
* 提交一次已由支付设备确认成功的非 Wallet 支付。
|
|
384
|
+
*
|
|
385
|
+
* 与 addOrderPayment 不同,本入口不会启动后台 fire-and-forget 同步;调用方会等待
|
|
386
|
+
* 本次 payment、当前 pending Wallet 以及订单提交共同完成。任何同步失败都会恢复
|
|
387
|
+
* 调用前的 payments 与 payment_status,便于 UI 安全解锁并重试。
|
|
388
|
+
*/
|
|
389
|
+
commitPaymentMethodPayment(params: BaseSalesCommitPaymentMethodParams): Promise<BaseSalesCommitPaymentMethodResult>;
|
|
390
|
+
/**
|
|
391
|
+
* 按当前店铺的现金舍入配置计算金额,供现金支付 UI 使用。
|
|
392
|
+
*
|
|
393
|
+
* 舍入开关取自 CASHMANUAL 支付方式;舍入规则取自
|
|
394
|
+
* otherParams.order_rounding_setting,金额算法统一由 PaymentModule 维护。
|
|
395
|
+
*/
|
|
324
396
|
roundAmount(params: {
|
|
325
397
|
amount: string | number;
|
|
326
|
-
|
|
327
|
-
rule?: 'standard_rounding' | 'standard_down' | 'always_up' | 'always_down' | string;
|
|
328
|
-
}): {
|
|
329
|
-
originalAmount: string;
|
|
330
|
-
roundedAmount: string;
|
|
331
|
-
roundingDifference: string;
|
|
332
|
-
};
|
|
398
|
+
}): Promise<RoundingResult>;
|
|
333
399
|
/**
|
|
334
400
|
* 发送支付链接。
|
|
335
401
|
*
|