@pisell/pisellos 2.2.309 → 2.2.311
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/index.js +4 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +21 -12
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +733 -373
- package/dist/modules/Order/types.d.ts +17 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +19 -5
- package/dist/modules/Order/utils.js +306 -86
- package/dist/modules/Payment/index.d.ts +0 -5
- package/dist/modules/Payment/index.js +35 -85
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/ProductList/index.js +18 -5
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/index.js +8 -5
- package/dist/server/modules/floor-plan/index.js +34 -3
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +12 -0
- package/dist/server/modules/payment/index.d.ts +25 -6
- package/dist/server/modules/payment/index.js +660 -133
- package/dist/server/utils/small-ticket.d.ts +8 -5
- package/dist/server/utils/small-ticket.js +1269 -199
- package/dist/solution/BaseSales/index.d.ts +11 -2
- package/dist/solution/BaseSales/index.js +1463 -1173
- package/dist/solution/BaseSales/types.d.ts +7 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingTicket/index.d.ts +11 -2
- package/dist/solution/BookingTicket/index.js +663 -542
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +5 -5
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/os-private-payload.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/index.js +3 -3
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +11 -2
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +341 -71
- package/lib/modules/Order/types.d.ts +17 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +19 -5
- package/lib/modules/Order/utils.js +215 -13
- package/lib/modules/Payment/index.d.ts +0 -5
- package/lib/modules/Payment/index.js +3 -28
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/ProductList/index.js +14 -1
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/index.js +8 -5
- package/lib/server/modules/floor-plan/index.js +29 -1
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +12 -0
- package/lib/server/modules/payment/index.d.ts +25 -6
- package/lib/server/modules/payment/index.js +350 -78
- package/lib/server/utils/small-ticket.d.ts +8 -5
- package/lib/server/utils/small-ticket.js +1009 -121
- package/lib/solution/BaseSales/index.d.ts +11 -2
- package/lib/solution/BaseSales/index.js +164 -30
- package/lib/solution/BaseSales/types.d.ts +7 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingTicket/index.d.ts +11 -2
- package/lib/solution/BookingTicket/index.js +103 -41
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +5 -5
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/os-private-payload.js +22 -0
- package/package.json +1 -1
|
@@ -171,11 +171,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
171
171
|
* 获取钱包支付方式
|
|
172
172
|
*/
|
|
173
173
|
getWalletPaymentMethod(): Promise<PaymentMethod | null>;
|
|
174
|
-
/**
|
|
175
|
-
* 确保支付模块所需的数据库表已创建
|
|
176
|
-
*/
|
|
177
|
-
/** @deprecated */
|
|
178
|
-
private ensurePaymentTables;
|
|
179
174
|
/**
|
|
180
175
|
* 获取部分支付的订单
|
|
181
176
|
*/
|
|
@@ -198,10 +198,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
198
198
|
this.app = this.appPlugin.getApp();
|
|
199
199
|
this.dbManager = this.app.dbManager;
|
|
200
200
|
this.logger = this.app.logger;
|
|
201
|
-
|
|
202
|
-
// 确保支付模块所需的对象存储已创建
|
|
203
|
-
// await this.ensurePaymentTables();
|
|
204
|
-
|
|
205
201
|
this.registerNetworkHandlers();
|
|
206
202
|
|
|
207
203
|
// // 预连接数据库
|
|
@@ -1740,7 +1736,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1740
1736
|
case 0:
|
|
1741
1737
|
_context21.prev = 0;
|
|
1742
1738
|
_context21.next = 3;
|
|
1743
|
-
return this.
|
|
1739
|
+
return this.getPayMethodListAsync();
|
|
1744
1740
|
case 3:
|
|
1745
1741
|
payMethods = _context21.sent;
|
|
1746
1742
|
return _context21.abrupt("return", payMethods.find(function (method) {
|
|
@@ -1776,7 +1772,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1776
1772
|
case 0:
|
|
1777
1773
|
_context22.prev = 0;
|
|
1778
1774
|
_context22.next = 3;
|
|
1779
|
-
return this.
|
|
1775
|
+
return this.getPayMethodListAsync();
|
|
1780
1776
|
case 3:
|
|
1781
1777
|
payMethods = _context22.sent;
|
|
1782
1778
|
return _context22.abrupt("return", payMethods.find(function (method) {
|
|
@@ -1812,7 +1808,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1812
1808
|
case 0:
|
|
1813
1809
|
_context23.prev = 0;
|
|
1814
1810
|
_context23.next = 3;
|
|
1815
|
-
return this.
|
|
1811
|
+
return this.getPayMethodListAsync();
|
|
1816
1812
|
case 3:
|
|
1817
1813
|
payMethods = _context23.sent;
|
|
1818
1814
|
return _context23.abrupt("return", payMethods.find(function (method) {
|
|
@@ -1835,82 +1831,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1835
1831
|
return getWalletPaymentMethod;
|
|
1836
1832
|
}()
|
|
1837
1833
|
/**
|
|
1838
|
-
*
|
|
1834
|
+
* 获取部分支付的订单
|
|
1839
1835
|
*/
|
|
1840
1836
|
/** @deprecated */
|
|
1841
1837
|
)
|
|
1842
1838
|
}, {
|
|
1843
|
-
key: "
|
|
1839
|
+
key: "getPartiallyPaidOrdersAsync",
|
|
1844
1840
|
value: (function () {
|
|
1845
|
-
var
|
|
1841
|
+
var _getPartiallyPaidOrdersAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1842
|
+
var allOrders;
|
|
1846
1843
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1847
1844
|
while (1) switch (_context24.prev = _context24.next) {
|
|
1848
1845
|
case 0:
|
|
1849
1846
|
_context24.prev = 0;
|
|
1850
1847
|
_context24.next = 3;
|
|
1851
|
-
return this.dbManager.getAll('pay_method');
|
|
1852
|
-
case 3:
|
|
1853
|
-
_context24.next = 9;
|
|
1854
|
-
break;
|
|
1855
|
-
case 5:
|
|
1856
|
-
_context24.prev = 5;
|
|
1857
|
-
_context24.t0 = _context24["catch"](0);
|
|
1858
|
-
console.warn('[PaymentModule] pay_method 表不存在,请在数据库配置中添加以下配置:');
|
|
1859
|
-
console.warn('{ name: "pay_method", keyPath: "id" }');
|
|
1860
|
-
case 9:
|
|
1861
|
-
_context24.prev = 9;
|
|
1862
|
-
_context24.next = 12;
|
|
1863
|
-
return this.dbManager.getAll('order');
|
|
1864
|
-
case 12:
|
|
1865
|
-
_context24.next = 18;
|
|
1866
|
-
break;
|
|
1867
|
-
case 14:
|
|
1868
|
-
_context24.prev = 14;
|
|
1869
|
-
_context24.t1 = _context24["catch"](9);
|
|
1870
|
-
console.warn('[PaymentModule] order 表不存在,请在数据库配置中添加以下配置:');
|
|
1871
|
-
console.warn('{ name: "order", keyPath: "uuid" }');
|
|
1872
|
-
case 18:
|
|
1873
|
-
case "end":
|
|
1874
|
-
return _context24.stop();
|
|
1875
|
-
}
|
|
1876
|
-
}, _callee24, this, [[0, 5], [9, 14]]);
|
|
1877
|
-
}));
|
|
1878
|
-
function ensurePaymentTables() {
|
|
1879
|
-
return _ensurePaymentTables.apply(this, arguments);
|
|
1880
|
-
}
|
|
1881
|
-
return ensurePaymentTables;
|
|
1882
|
-
}()
|
|
1883
|
-
/**
|
|
1884
|
-
* 获取部分支付的订单
|
|
1885
|
-
*/
|
|
1886
|
-
/** @deprecated */
|
|
1887
|
-
)
|
|
1888
|
-
}, {
|
|
1889
|
-
key: "getPartiallyPaidOrdersAsync",
|
|
1890
|
-
value: (function () {
|
|
1891
|
-
var _getPartiallyPaidOrdersAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1892
|
-
var allOrders;
|
|
1893
|
-
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1894
|
-
while (1) switch (_context25.prev = _context25.next) {
|
|
1895
|
-
case 0:
|
|
1896
|
-
_context25.prev = 0;
|
|
1897
|
-
_context25.next = 3;
|
|
1898
1848
|
return this.dbManager.getAll('order');
|
|
1899
1849
|
case 3:
|
|
1900
|
-
allOrders =
|
|
1901
|
-
return
|
|
1850
|
+
allOrders = _context24.sent;
|
|
1851
|
+
return _context24.abrupt("return", allOrders.filter(function (order) {
|
|
1902
1852
|
return order.payment_status === PaymentStatus.PartiallyPaid;
|
|
1903
1853
|
}));
|
|
1904
1854
|
case 7:
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
console.error('[PaymentModule] 获取部分支付订单失败',
|
|
1908
|
-
return
|
|
1855
|
+
_context24.prev = 7;
|
|
1856
|
+
_context24.t0 = _context24["catch"](0);
|
|
1857
|
+
console.error('[PaymentModule] 获取部分支付订单失败', _context24.t0);
|
|
1858
|
+
return _context24.abrupt("return", []);
|
|
1909
1859
|
case 11:
|
|
1910
1860
|
case "end":
|
|
1911
|
-
return
|
|
1861
|
+
return _context24.stop();
|
|
1912
1862
|
}
|
|
1913
|
-
},
|
|
1863
|
+
}, _callee24, this, [[0, 7]]);
|
|
1914
1864
|
}));
|
|
1915
1865
|
function getPartiallyPaidOrdersAsync() {
|
|
1916
1866
|
return _getPartiallyPaidOrdersAsync.apply(this, arguments);
|
|
@@ -1931,17 +1881,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1931
1881
|
}, {
|
|
1932
1882
|
key: "roundAmountAsync",
|
|
1933
1883
|
value: function () {
|
|
1934
|
-
var _roundAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1884
|
+
var _roundAmountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(originalAmount, interval, rule) {
|
|
1935
1885
|
var amount, roundingInterval, supportedIntervals, intervalValue, baseValue, roundedValue, finalAmount, originalAmountStr, roundedAmountStr, roundingDifference, roundingDifferenceStr;
|
|
1936
|
-
return _regeneratorRuntime().wrap(function
|
|
1937
|
-
while (1) switch (
|
|
1886
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1887
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1938
1888
|
case 0:
|
|
1939
|
-
|
|
1889
|
+
_context25.prev = 0;
|
|
1940
1890
|
// 参数验证
|
|
1941
1891
|
amount = new Decimal(originalAmount);
|
|
1942
1892
|
roundingInterval = new Decimal(interval);
|
|
1943
1893
|
if (!roundingInterval.lte(0)) {
|
|
1944
|
-
|
|
1894
|
+
_context25.next = 5;
|
|
1945
1895
|
break;
|
|
1946
1896
|
}
|
|
1947
1897
|
throw new Error('舍入间隔必须大于 0');
|
|
@@ -1955,25 +1905,25 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1955
1905
|
|
|
1956
1906
|
// 计算基础值:x / interval
|
|
1957
1907
|
baseValue = amount.div(roundingInterval);
|
|
1958
|
-
|
|
1959
|
-
|
|
1908
|
+
_context25.t0 = rule;
|
|
1909
|
+
_context25.next = _context25.t0 === RoundingRule.Standard ? 12 : _context25.t0 === 'standard' ? 12 : _context25.t0 === RoundingRule.StandardDown ? 14 : _context25.t0 === 'standard_rounding_midpoint_down' ? 14 : _context25.t0 === RoundingRule.AlwaysUp ? 16 : _context25.t0 === 'always_up' ? 16 : _context25.t0 === RoundingRule.AlwaysDown ? 18 : _context25.t0 === 'always_down' ? 18 : 20;
|
|
1960
1910
|
break;
|
|
1961
1911
|
case 12:
|
|
1962
1912
|
// 标准舍入(中点向上)
|
|
1963
1913
|
roundedValue = this.standardRound(baseValue, true);
|
|
1964
|
-
return
|
|
1914
|
+
return _context25.abrupt("break", 21);
|
|
1965
1915
|
case 14:
|
|
1966
1916
|
// 标准舍入(中点向下)
|
|
1967
1917
|
roundedValue = this.standardRound(baseValue, false);
|
|
1968
|
-
return
|
|
1918
|
+
return _context25.abrupt("break", 21);
|
|
1969
1919
|
case 16:
|
|
1970
1920
|
// 总是向上舍入
|
|
1971
1921
|
roundedValue = baseValue.ceil();
|
|
1972
|
-
return
|
|
1922
|
+
return _context25.abrupt("break", 21);
|
|
1973
1923
|
case 18:
|
|
1974
1924
|
// 总是向下舍入
|
|
1975
1925
|
roundedValue = baseValue.floor();
|
|
1976
|
-
return
|
|
1926
|
+
return _context25.abrupt("break", 21);
|
|
1977
1927
|
case 20:
|
|
1978
1928
|
throw new Error("\u4E0D\u652F\u6301\u7684\u820D\u5165\u89C4\u5219: ".concat(rule));
|
|
1979
1929
|
case 21:
|
|
@@ -1981,10 +1931,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1981
1931
|
finalAmount = roundedValue.mul(roundingInterval);
|
|
1982
1932
|
originalAmountStr = amount.toFixed(2); // 如果最终金额是 0 元,则不采用舍入金额,返回原始金额
|
|
1983
1933
|
if (!finalAmount.eq(0)) {
|
|
1984
|
-
|
|
1934
|
+
_context25.next = 25;
|
|
1985
1935
|
break;
|
|
1986
1936
|
}
|
|
1987
|
-
return
|
|
1937
|
+
return _context25.abrupt("return", {
|
|
1988
1938
|
originalAmount: originalAmountStr,
|
|
1989
1939
|
roundedAmount: originalAmountStr,
|
|
1990
1940
|
roundingDifference: '0.00'
|
|
@@ -1993,21 +1943,21 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1993
1943
|
roundedAmountStr = finalAmount.toFixed(2); // 计算舍入差额
|
|
1994
1944
|
roundingDifference = finalAmount.sub(amount);
|
|
1995
1945
|
roundingDifferenceStr = roundingDifference.toFixed(2);
|
|
1996
|
-
return
|
|
1946
|
+
return _context25.abrupt("return", {
|
|
1997
1947
|
originalAmount: originalAmountStr,
|
|
1998
1948
|
roundedAmount: roundedAmountStr,
|
|
1999
1949
|
roundingDifference: roundingDifferenceStr
|
|
2000
1950
|
});
|
|
2001
1951
|
case 31:
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
console.error('[PaymentModule] 金额舍入失败:',
|
|
2005
|
-
throw new Error("\u91D1\u989D\u820D\u5165\u5931\u8D25: ".concat(
|
|
1952
|
+
_context25.prev = 31;
|
|
1953
|
+
_context25.t1 = _context25["catch"](0);
|
|
1954
|
+
console.error('[PaymentModule] 金额舍入失败:', _context25.t1);
|
|
1955
|
+
throw new Error("\u91D1\u989D\u820D\u5165\u5931\u8D25: ".concat(_context25.t1 instanceof Error ? _context25.t1.message : String(_context25.t1)));
|
|
2006
1956
|
case 35:
|
|
2007
1957
|
case "end":
|
|
2008
|
-
return
|
|
1958
|
+
return _context25.stop();
|
|
2009
1959
|
}
|
|
2010
|
-
},
|
|
1960
|
+
}, _callee25, this, [[0, 31]]);
|
|
2011
1961
|
}));
|
|
2012
1962
|
function roundAmountAsync(_x27, _x28, _x29) {
|
|
2013
1963
|
return _roundAmountAsync.apply(this, arguments);
|
|
@@ -412,6 +412,8 @@ export interface WalletAssetsBehaviorOptions {
|
|
|
412
412
|
export interface RefreshWalletAssetsOptions {
|
|
413
413
|
/** 商品/金额变化默认保留并重验选择;客户变化由实现层强制清空。 */
|
|
414
414
|
preserveSelection?: boolean;
|
|
415
|
+
/** 客户变化时,仅保留与本次扫码匹配的搜索结果;其他搜索缓存仍会清空。 */
|
|
416
|
+
retainSearchResultCodes?: string[];
|
|
415
417
|
}
|
|
416
418
|
export interface SelectWalletAssetOptions {
|
|
417
419
|
selected: boolean;
|
|
@@ -419,6 +421,8 @@ export interface SelectWalletAssetOptions {
|
|
|
419
421
|
}
|
|
420
422
|
export interface ScanWalletAssetResult {
|
|
421
423
|
type: SearchIdentificationCodeResult['type'];
|
|
424
|
+
/** walletCode 时保留完整 Wallet Detail,供客户解析与客户选择器使用。 */
|
|
425
|
+
data?: WalletDetailSearchData;
|
|
422
426
|
asset?: any;
|
|
423
427
|
selected: boolean;
|
|
424
428
|
state: WalletAssetsState;
|
|
@@ -864,6 +868,8 @@ export interface SearchIdentificationCodeParams extends WalletDeductionRecommend
|
|
|
864
868
|
* 搜索识别码响应数据
|
|
865
869
|
*/
|
|
866
870
|
export interface SearchIdentificationCodeResponse {
|
|
871
|
+
/** 业务是否成功 */
|
|
872
|
+
status?: boolean;
|
|
867
873
|
/** 响应状态码 */
|
|
868
874
|
code?: number;
|
|
869
875
|
/** 响应消息 */
|
|
@@ -871,12 +877,26 @@ export interface SearchIdentificationCodeResponse {
|
|
|
871
877
|
/** 响应数据 */
|
|
872
878
|
data?: SearchIdentificationCodeItem[];
|
|
873
879
|
}
|
|
880
|
+
/** Wallet code 精确搜索返回的 Wallet Detail。 */
|
|
881
|
+
export interface WalletDetailSearchData {
|
|
882
|
+
id?: string | number;
|
|
883
|
+
customer_id?: string | number;
|
|
884
|
+
customer?: Record<string, any> | null;
|
|
885
|
+
is_cross_shop_wallet?: boolean | 0 | 1;
|
|
886
|
+
[key: string]: any;
|
|
887
|
+
}
|
|
888
|
+
export interface WalletDetailSearchResponse {
|
|
889
|
+
status?: boolean;
|
|
890
|
+
code?: number;
|
|
891
|
+
message?: string;
|
|
892
|
+
data?: WalletDetailSearchData | null;
|
|
893
|
+
}
|
|
874
894
|
/**
|
|
875
895
|
* 搜索识别码结果类型
|
|
876
896
|
*/
|
|
877
897
|
export type SearchIdentificationCodeResult = {
|
|
878
898
|
type: 'walletCode';
|
|
879
|
-
data:
|
|
899
|
+
data: WalletDetailSearchData;
|
|
880
900
|
} | {
|
|
881
901
|
type: 'normalCode';
|
|
882
902
|
data: SearchIdentificationCodeItem[];
|
|
@@ -96,7 +96,7 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
96
96
|
* 搜索识别码信息
|
|
97
97
|
* 通过识别码搜索相关的钱包通行证信息
|
|
98
98
|
* 基于 WalletDeductionRecommendParams 参数结构
|
|
99
|
-
*
|
|
99
|
+
* 特殊逻辑:WL 或指定 200 格式的 Wallet Code 调用 /wallet/detail/search 接口。
|
|
100
100
|
*/
|
|
101
101
|
searchIdentificationCodeAsync(params: SearchIdentificationCodeParams, config?: {
|
|
102
102
|
noCache?: boolean;
|
|
@@ -933,7 +933,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
933
933
|
* 搜索识别码信息
|
|
934
934
|
* 通过识别码搜索相关的钱包通行证信息
|
|
935
935
|
* 基于 WalletDeductionRecommendParams 参数结构
|
|
936
|
-
*
|
|
936
|
+
* 特殊逻辑:WL 或指定 200 格式的 Wallet Code 调用 /wallet/detail/search 接口。
|
|
937
937
|
*/
|
|
938
938
|
}, {
|
|
939
939
|
key: "searchIdentificationCodeAsync",
|
|
@@ -957,7 +957,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
957
957
|
isWalletCode,
|
|
958
958
|
walletDetailParams,
|
|
959
959
|
_response,
|
|
960
|
-
|
|
960
|
+
walletDetail,
|
|
961
961
|
baseWalletParams,
|
|
962
962
|
searchParams,
|
|
963
963
|
response,
|
|
@@ -981,13 +981,14 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
981
981
|
// 新钱包规则
|
|
982
982
|
isWalletCode = code.startsWith('WL') || code.startsWith('200') && code.length === 10;
|
|
983
983
|
if (!isWalletCode) {
|
|
984
|
-
_context7.next =
|
|
984
|
+
_context7.next = 16;
|
|
985
985
|
break;
|
|
986
986
|
}
|
|
987
987
|
// 钱包识别码直接调用专门接口,不缓存,直接返回
|
|
988
988
|
walletDetailParams = {
|
|
989
989
|
code: code,
|
|
990
990
|
with_customer: 1,
|
|
991
|
+
with_franchisor_data: 1,
|
|
991
992
|
with: ['wallet']
|
|
992
993
|
};
|
|
993
994
|
this.paymentModule.logInfo('[WalletPass] 搜索钱包识别码', {
|
|
@@ -999,17 +1000,23 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
999
1000
|
return this.paymentModule.request.post('/wallet/detail/search', walletDetailParams);
|
|
1000
1001
|
case 10:
|
|
1001
1002
|
_response = _context7.sent;
|
|
1002
|
-
|
|
1003
|
+
walletDetail = _response === null || _response === void 0 ? void 0 : _response.data;
|
|
1004
|
+
if (!((_response === null || _response === void 0 ? void 0 : _response.status) !== true || (_response === null || _response === void 0 ? void 0 : _response.code) !== 200 || !walletDetail || _typeof(walletDetail) !== 'object' || Array.isArray(walletDetail))) {
|
|
1005
|
+
_context7.next = 14;
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
throw new Error((_response === null || _response === void 0 ? void 0 : _response.message) || 'Wallet detail search failed');
|
|
1009
|
+
case 14:
|
|
1003
1010
|
this.paymentModule.logInfo('[WalletPass] 钱包识别码搜索完成', {
|
|
1004
1011
|
code: code,
|
|
1005
|
-
results_count:
|
|
1012
|
+
results_count: 1,
|
|
1006
1013
|
type: 'walletCode'
|
|
1007
1014
|
});
|
|
1008
1015
|
return _context7.abrupt("return", {
|
|
1009
1016
|
type: 'walletCode',
|
|
1010
|
-
data:
|
|
1017
|
+
data: walletDetail
|
|
1011
1018
|
});
|
|
1012
|
-
case
|
|
1019
|
+
case 16:
|
|
1013
1020
|
// 合并钱包参数和搜索参数
|
|
1014
1021
|
baseWalletParams = this.walletParams; // 构建完整的搜索参数,包含钱包扣款推荐的所有参数
|
|
1015
1022
|
searchParams = {
|
|
@@ -1037,20 +1044,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1037
1044
|
if (typeof searchParams.payment_order_id === 'string' && searchParams.payment_order_id.startsWith('LOCAL_')) {
|
|
1038
1045
|
searchParams.payment_order_id = undefined;
|
|
1039
1046
|
}
|
|
1040
|
-
_context7.next =
|
|
1047
|
+
_context7.next = 22;
|
|
1041
1048
|
return this.paymentModule.request.post('/machinecode/prepare/deduction/search', searchParams);
|
|
1042
|
-
case
|
|
1049
|
+
case 22:
|
|
1043
1050
|
response = _context7.sent;
|
|
1044
1051
|
searchResults = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
1045
1052
|
if (!config.noCache) {
|
|
1046
|
-
_context7.next =
|
|
1053
|
+
_context7.next = 26;
|
|
1047
1054
|
break;
|
|
1048
1055
|
}
|
|
1049
1056
|
return _context7.abrupt("return", {
|
|
1050
1057
|
type: 'normalCode',
|
|
1051
1058
|
data: searchResults
|
|
1052
1059
|
});
|
|
1053
|
-
case
|
|
1060
|
+
case 26:
|
|
1054
1061
|
// 将搜索结果存储到缓存数组中
|
|
1055
1062
|
if (searchResults.length > 0) {
|
|
1056
1063
|
// 避免重复存储相同的识别码
|
|
@@ -1080,8 +1087,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1080
1087
|
type: 'normalCode',
|
|
1081
1088
|
data: searchResults
|
|
1082
1089
|
});
|
|
1083
|
-
case
|
|
1084
|
-
_context7.prev =
|
|
1090
|
+
case 32:
|
|
1091
|
+
_context7.prev = 32;
|
|
1085
1092
|
_context7.t0 = _context7["catch"](1);
|
|
1086
1093
|
this.paymentModule.logError('[WalletPass] 搜索识别码信息失败', _context7.t0, {
|
|
1087
1094
|
code: params.code,
|
|
@@ -1089,11 +1096,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1089
1096
|
order_expect_amount: params.order_expect_amount
|
|
1090
1097
|
});
|
|
1091
1098
|
throw _context7.t0;
|
|
1092
|
-
case
|
|
1099
|
+
case 36:
|
|
1093
1100
|
case "end":
|
|
1094
1101
|
return _context7.stop();
|
|
1095
1102
|
}
|
|
1096
|
-
}, _callee7, this, [[1,
|
|
1103
|
+
}, _callee7, this, [[1, 32]]);
|
|
1097
1104
|
}));
|
|
1098
1105
|
function searchIdentificationCodeAsync(_x8) {
|
|
1099
1106
|
return _searchIdentificationCodeAsync.apply(this, arguments);
|
|
@@ -1119,6 +1126,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1119
1126
|
previousCustomerId,
|
|
1120
1127
|
customerChanged,
|
|
1121
1128
|
preserveSelection,
|
|
1129
|
+
retainedSearchCodeKeys,
|
|
1130
|
+
retainedSearchResults,
|
|
1131
|
+
preserveSearchContext,
|
|
1122
1132
|
committedKeys,
|
|
1123
1133
|
committedItems,
|
|
1124
1134
|
selectedIds,
|
|
@@ -1153,9 +1163,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1153
1163
|
previousCustomerId = this.walletAssetsState.customerId;
|
|
1154
1164
|
customerChanged = String(previousCustomerId !== null && previousCustomerId !== void 0 ? previousCustomerId : '') !== String(nextCustomerId !== null && nextCustomerId !== void 0 ? nextCustomerId : '');
|
|
1155
1165
|
preserveSelection = options.preserveSelection !== false && !customerChanged;
|
|
1166
|
+
retainedSearchCodeKeys = new Set((options.retainSearchResultCodes || []).map(normalizeWalletAssetCode).filter(Boolean));
|
|
1167
|
+
retainedSearchResults = customerChanged && retainedSearchCodeKeys.size > 0 ? this.searchResults.filter(function (item) {
|
|
1168
|
+
return isWalletPaymentAsset(item) && getWalletAssetCodeKeys(item).some(function (code) {
|
|
1169
|
+
return retainedSearchCodeKeys.has(code);
|
|
1170
|
+
});
|
|
1171
|
+
}) : [];
|
|
1156
1172
|
if (customerChanged) {
|
|
1157
1173
|
this.clearSearchResults();
|
|
1174
|
+
if (retainedSearchResults.length > 0) {
|
|
1175
|
+
this.searchResults = mergeWalletAssets(retainedSearchResults);
|
|
1176
|
+
this.queuePendingAutoSelectForAssets(retainedSearchResults);
|
|
1177
|
+
}
|
|
1158
1178
|
}
|
|
1179
|
+
preserveSearchContext = preserveSelection || retainedSearchResults.length > 0;
|
|
1159
1180
|
committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
|
|
1160
1181
|
return String(id);
|
|
1161
1182
|
}));
|
|
@@ -1180,7 +1201,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1180
1201
|
// 清空购物车时保留扫码资产供后续加购恢复;只有手动 Remove/Clear
|
|
1181
1202
|
// 会取消自动应用资格,商品变化导致的自动失效需要重新进入待选队列。
|
|
1182
1203
|
if ((_businessData$product2 = businessData.products) !== null && _businessData$product2 !== void 0 && _businessData$product2.length) {
|
|
1183
|
-
_context8.next =
|
|
1204
|
+
_context8.next = 27;
|
|
1184
1205
|
break;
|
|
1185
1206
|
}
|
|
1186
1207
|
this.queuePendingAutoSelectForAssets(scanSelectedAssets);
|
|
@@ -1218,7 +1239,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1218
1239
|
totalSelectedAmount: 0,
|
|
1219
1240
|
error: null
|
|
1220
1241
|
}));
|
|
1221
|
-
case
|
|
1242
|
+
case 27:
|
|
1222
1243
|
this.publishWalletAssetsState({
|
|
1223
1244
|
status: 'loading',
|
|
1224
1245
|
customerId: nextCustomerId,
|
|
@@ -1229,40 +1250,40 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1229
1250
|
totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
|
|
1230
1251
|
error: null
|
|
1231
1252
|
});
|
|
1232
|
-
_context8.prev =
|
|
1233
|
-
searchedWalletAssetCodes =
|
|
1234
|
-
useAggregateRecalculate =
|
|
1253
|
+
_context8.prev = 28;
|
|
1254
|
+
searchedWalletAssetCodes = preserveSearchContext ? this.getSearchedWalletAssetCodes() : [];
|
|
1255
|
+
useAggregateRecalculate = preserveSearchContext && (selectedIds.length > 0 || searchedWalletAssetCodes.length > 0);
|
|
1235
1256
|
if (!useAggregateRecalculate) {
|
|
1236
|
-
_context8.next =
|
|
1257
|
+
_context8.next = 37;
|
|
1237
1258
|
break;
|
|
1238
1259
|
}
|
|
1239
|
-
_context8.next =
|
|
1260
|
+
_context8.next = 34;
|
|
1240
1261
|
return this.aggregateRecalculateWalletAssetsAsync(businessData, selectedIds);
|
|
1241
|
-
case
|
|
1262
|
+
case 34:
|
|
1242
1263
|
_context8.t0 = _context8.sent;
|
|
1243
|
-
_context8.next =
|
|
1264
|
+
_context8.next = 38;
|
|
1244
1265
|
break;
|
|
1245
|
-
case
|
|
1266
|
+
case 37:
|
|
1246
1267
|
_context8.t0 = null;
|
|
1247
|
-
case
|
|
1268
|
+
case 38:
|
|
1248
1269
|
aggregateResult = _context8.t0;
|
|
1249
1270
|
_context8.t1 = aggregateResult;
|
|
1250
1271
|
if (_context8.t1) {
|
|
1251
|
-
_context8.next =
|
|
1272
|
+
_context8.next = 44;
|
|
1252
1273
|
break;
|
|
1253
1274
|
}
|
|
1254
|
-
_context8.next =
|
|
1275
|
+
_context8.next = 43;
|
|
1255
1276
|
return this.initializeWalletDataFromBusinessAsync(businessData);
|
|
1256
|
-
case
|
|
1277
|
+
case 43:
|
|
1257
1278
|
_context8.t1 = _context8.sent;
|
|
1258
|
-
case
|
|
1279
|
+
case 44:
|
|
1259
1280
|
result = _context8.t1;
|
|
1260
1281
|
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
1261
|
-
_context8.next =
|
|
1282
|
+
_context8.next = 47;
|
|
1262
1283
|
break;
|
|
1263
1284
|
}
|
|
1264
1285
|
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1265
|
-
case
|
|
1286
|
+
case 47:
|
|
1266
1287
|
this.walletAssetsCalculationContext = {
|
|
1267
1288
|
orderTotalAmount: Number(businessData.order_wait_pay_amount || 0),
|
|
1268
1289
|
products: result.products || businessData.products || []
|
|
@@ -1283,13 +1304,13 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1283
1304
|
});
|
|
1284
1305
|
}
|
|
1285
1306
|
}
|
|
1286
|
-
searchedWalletAssets =
|
|
1307
|
+
searchedWalletAssets = preserveSearchContext ? this.syncSearchedWalletAssets([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || []))) : [];
|
|
1287
1308
|
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
1288
|
-
_context8.next =
|
|
1309
|
+
_context8.next = 53;
|
|
1289
1310
|
break;
|
|
1290
1311
|
}
|
|
1291
1312
|
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1292
|
-
case
|
|
1313
|
+
case 53:
|
|
1293
1314
|
recommendedKeys = new Set((result.walletRecommendList || []).map(function (asset) {
|
|
1294
1315
|
return getWalletAssetKey(asset);
|
|
1295
1316
|
}));
|
|
@@ -1335,15 +1356,15 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1335
1356
|
});
|
|
1336
1357
|
this.queuePendingAutoSelectForAssets(droppedScanSelectedAssets);
|
|
1337
1358
|
return _context8.abrupt("return", nextState);
|
|
1338
|
-
case
|
|
1339
|
-
_context8.prev =
|
|
1340
|
-
_context8.t2 = _context8["catch"](
|
|
1359
|
+
case 68:
|
|
1360
|
+
_context8.prev = 68;
|
|
1361
|
+
_context8.t2 = _context8["catch"](28);
|
|
1341
1362
|
if (!(requestSequence !== this.walletAssetsRequestSequence)) {
|
|
1342
|
-
_context8.next =
|
|
1363
|
+
_context8.next = 72;
|
|
1343
1364
|
break;
|
|
1344
1365
|
}
|
|
1345
1366
|
return _context8.abrupt("return", this.getWalletAssetsState());
|
|
1346
|
-
case
|
|
1367
|
+
case 72:
|
|
1347
1368
|
this.paymentModule.logError('[WalletPass] 刷新共享钱包资产失败,保留刷新前状态', _context8.t2, {
|
|
1348
1369
|
customer_id: businessData.customer_id,
|
|
1349
1370
|
selected_ids: selectedIds,
|
|
@@ -1359,11 +1380,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1359
1380
|
customerId: nextCustomerId,
|
|
1360
1381
|
error: _context8.t2 instanceof Error ? _context8.t2.message : String(_context8.t2)
|
|
1361
1382
|
}));
|
|
1362
|
-
case
|
|
1383
|
+
case 74:
|
|
1363
1384
|
case "end":
|
|
1364
1385
|
return _context8.stop();
|
|
1365
1386
|
}
|
|
1366
|
-
}, _callee8, this, [[
|
|
1387
|
+
}, _callee8, this, [[28, 68]]);
|
|
1367
1388
|
}));
|
|
1368
1389
|
function refreshWalletAssetsFromBusinessAsync(_x9) {
|
|
1369
1390
|
return _refreshWalletAssetsFromBusinessAsync.apply(this, arguments);
|
|
@@ -1541,6 +1562,18 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1541
1562
|
}));
|
|
1542
1563
|
case 9:
|
|
1543
1564
|
result = _context9.sent;
|
|
1565
|
+
if (!(result.type === 'walletCode')) {
|
|
1566
|
+
_context9.next = 12;
|
|
1567
|
+
break;
|
|
1568
|
+
}
|
|
1569
|
+
return _context9.abrupt("return", {
|
|
1570
|
+
type: 'walletCode',
|
|
1571
|
+
data: result.data,
|
|
1572
|
+
asset: result.data,
|
|
1573
|
+
selected: false,
|
|
1574
|
+
state: this.getWalletAssetsState()
|
|
1575
|
+
});
|
|
1576
|
+
case 12:
|
|
1544
1577
|
paymentAssets = this.formatSearchedWalletPaymentAssets(result.data.filter(isWalletPaymentAsset));
|
|
1545
1578
|
if (paymentAssets.length > 0) {
|
|
1546
1579
|
this.searchResults = mergeWalletAssets(this.searchResults, paymentAssets);
|
|
@@ -1548,17 +1581,17 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1548
1581
|
asset = paymentAssets.find(function (item) {
|
|
1549
1582
|
return String((item === null || item === void 0 ? void 0 : item.code) || '') === normalizedCode;
|
|
1550
1583
|
}) || paymentAssets[0];
|
|
1551
|
-
if (
|
|
1552
|
-
_context9.next =
|
|
1584
|
+
if (asset) {
|
|
1585
|
+
_context9.next = 17;
|
|
1553
1586
|
break;
|
|
1554
1587
|
}
|
|
1555
1588
|
return _context9.abrupt("return", {
|
|
1556
|
-
type:
|
|
1589
|
+
type: 'normalCode',
|
|
1557
1590
|
asset: asset,
|
|
1558
1591
|
selected: false,
|
|
1559
1592
|
state: this.getWalletAssetsState()
|
|
1560
1593
|
});
|
|
1561
|
-
case
|
|
1594
|
+
case 17:
|
|
1562
1595
|
items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
|
|
1563
1596
|
recalculatedState = this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
|
|
1564
1597
|
assetId = getWalletAssetId(asset);
|
|
@@ -1588,7 +1621,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
1588
1621
|
selected: isSelected,
|
|
1589
1622
|
state: selected
|
|
1590
1623
|
});
|
|
1591
|
-
case
|
|
1624
|
+
case 27:
|
|
1592
1625
|
case "end":
|
|
1593
1626
|
return _context9.stop();
|
|
1594
1627
|
}
|