@pisell/pisellos 2.2.275 → 2.2.277
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 +0 -1
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/Order/index.js +90 -89
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +208 -54
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +65 -39
- package/dist/solution/BaseSales/index.d.ts +5 -0
- package/dist/solution/BaseSales/index.js +319 -284
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +1 -4
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/Order/index.js +12 -10
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +183 -16
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +42 -7
- package/lib/solution/BaseSales/index.d.ts +5 -0
- package/lib/solution/BaseSales/index.js +17 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -4
- package/package.json +1 -1
|
@@ -52,6 +52,25 @@ function normalizeWalletAssetCode(code) {
|
|
|
52
52
|
function getWalletAssetCodeKeys(asset) {
|
|
53
53
|
return [asset == null ? void 0 : asset.code, asset == null ? void 0 : asset.encoded].map(normalizeWalletAssetCode).filter(Boolean);
|
|
54
54
|
}
|
|
55
|
+
function withWalletAssetRecalculationBaseAmount(asset) {
|
|
56
|
+
const existingBaseAmount = Number(
|
|
57
|
+
asset == null ? void 0 : asset._wallet_asset_recalculation_base_amount
|
|
58
|
+
);
|
|
59
|
+
if (Number.isFinite(existingBaseAmount) && existingBaseAmount >= 0) {
|
|
60
|
+
return asset;
|
|
61
|
+
}
|
|
62
|
+
if (!["product_voucher", "gift_card"].includes(asset == null ? void 0 : asset.tag)) {
|
|
63
|
+
return asset;
|
|
64
|
+
}
|
|
65
|
+
const balanceParValue = Number(asset == null ? void 0 : asset.balance_par_value);
|
|
66
|
+
if (!Number.isFinite(balanceParValue) || balanceParValue < 0) {
|
|
67
|
+
return asset;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...asset,
|
|
71
|
+
_wallet_asset_recalculation_base_amount: balanceParValue
|
|
72
|
+
};
|
|
73
|
+
}
|
|
55
74
|
function isWalletAssetAvailable(asset) {
|
|
56
75
|
if (!asset)
|
|
57
76
|
return false;
|
|
@@ -222,6 +241,42 @@ var WalletPassPaymentImpl = class {
|
|
|
222
241
|
error: null
|
|
223
242
|
});
|
|
224
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* 搜索接口只返回后端 Wallet Pass 数据,不包含前端策略 config。
|
|
246
|
+
* 在资产进入共享选择状态前补齐策略结果,避免增量重算回退到接口状态。
|
|
247
|
+
*/
|
|
248
|
+
formatSearchedWalletPaymentAssets(assets) {
|
|
249
|
+
var _a, _b, _c, _d;
|
|
250
|
+
if (!assets.length)
|
|
251
|
+
return assets;
|
|
252
|
+
const assetsWithRecalculationBase = assets.map(
|
|
253
|
+
withWalletAssetRecalculationBaseAmount
|
|
254
|
+
);
|
|
255
|
+
const evaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
256
|
+
if (!(evaluator == null ? void 0 : evaluator.searchVoucherFormat))
|
|
257
|
+
return assetsWithRecalculationBase;
|
|
258
|
+
const hasCalculationProducts = this.walletAssetsCalculationContext.products.length > 0;
|
|
259
|
+
const products = hasCalculationProducts ? this.walletAssetsCalculationContext.products : ((_c = this.walletParams) == null ? void 0 : _c.products) || [];
|
|
260
|
+
const orderTotalAmount = Number(
|
|
261
|
+
hasCalculationProducts ? this.walletAssetsCalculationContext.orderTotalAmount : ((_d = this.walletParams) == null ? void 0 : _d.order_wait_pay_amount) || 0
|
|
262
|
+
);
|
|
263
|
+
try {
|
|
264
|
+
const formattedAssets = evaluator.searchVoucherFormat({
|
|
265
|
+
orderTotalAmount,
|
|
266
|
+
products,
|
|
267
|
+
vouchers: assetsWithRecalculationBase
|
|
268
|
+
});
|
|
269
|
+
return formattedAssets;
|
|
270
|
+
} catch (error) {
|
|
271
|
+
this.paymentModule.logWarning(
|
|
272
|
+
"[WalletPass] 搜索资产策略格式化失败,保留接口结果",
|
|
273
|
+
{
|
|
274
|
+
error: error instanceof Error ? error.message : String(error)
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
return assetsWithRecalculationBase;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
225
280
|
/** 获取当前缓存中所有支付类 Wallet 资产的扫码 code。 */
|
|
226
281
|
getSearchedWalletAssetCodes() {
|
|
227
282
|
const cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
@@ -245,11 +300,23 @@ var WalletPassPaymentImpl = class {
|
|
|
245
300
|
);
|
|
246
301
|
if (searchedCodeKeys.size === 0)
|
|
247
302
|
return cachedAssets;
|
|
303
|
+
const cachedAssetByCode = /* @__PURE__ */ new Map();
|
|
304
|
+
cachedAssets.forEach((item) => {
|
|
305
|
+
getWalletAssetCodeKeys(item).forEach((code) => {
|
|
306
|
+
cachedAssetByCode.set(code, item);
|
|
307
|
+
});
|
|
308
|
+
});
|
|
248
309
|
const refreshedAssets = refreshedCandidates.filter(
|
|
249
310
|
(item) => isWalletPaymentAsset(item) && searchedCodeKeys.has(
|
|
250
311
|
String((item == null ? void 0 : item.code) || "").trim().toUpperCase()
|
|
251
312
|
)
|
|
252
|
-
)
|
|
313
|
+
).map((item) => {
|
|
314
|
+
const cachedAsset = getWalletAssetCodeKeys(item).map((code) => cachedAssetByCode.get(code)).find(Boolean);
|
|
315
|
+
return withWalletAssetRecalculationBaseAmount({
|
|
316
|
+
...cachedAsset,
|
|
317
|
+
...item
|
|
318
|
+
});
|
|
319
|
+
});
|
|
253
320
|
if (refreshedAssets.length > 0) {
|
|
254
321
|
const replacedCodes = new Set(
|
|
255
322
|
refreshedAssets.map(
|
|
@@ -321,6 +388,10 @@ var WalletPassPaymentImpl = class {
|
|
|
321
388
|
payment_order_id
|
|
322
389
|
};
|
|
323
390
|
this.walletParams = walletParams;
|
|
391
|
+
this.walletAssetsCalculationContext = {
|
|
392
|
+
orderTotalAmount: Number(walletParams.order_wait_pay_amount || 0),
|
|
393
|
+
products: Array.isArray(walletParams.products) ? walletParams.products : []
|
|
394
|
+
};
|
|
324
395
|
this.paymentModule.logInfo("[WalletPass] 钱包默认参数已生成并存储", {
|
|
325
396
|
customer_id: walletParams.customer_id,
|
|
326
397
|
holder_id: walletParams.holder_id,
|
|
@@ -472,7 +543,6 @@ var WalletPassPaymentImpl = class {
|
|
|
472
543
|
vouchers: allList
|
|
473
544
|
});
|
|
474
545
|
const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
|
|
475
|
-
console.log(res, "resres12");
|
|
476
546
|
this.walletRecommendList = recommended;
|
|
477
547
|
this.walletInitData = {
|
|
478
548
|
transformList,
|
|
@@ -552,7 +622,7 @@ var WalletPassPaymentImpl = class {
|
|
|
552
622
|
)
|
|
553
623
|
};
|
|
554
624
|
const returnedSelectedKeys = new Set(
|
|
555
|
-
|
|
625
|
+
allList.map((item) => getWalletAssetKey(item))
|
|
556
626
|
);
|
|
557
627
|
const authoritativeSelectedIds = selectedIds.filter(
|
|
558
628
|
(id) => returnedSelectedKeys.has(String(id))
|
|
@@ -818,6 +888,17 @@ var WalletPassPaymentImpl = class {
|
|
|
818
888
|
const assetId = getWalletAssetId(asset);
|
|
819
889
|
return assetId !== void 0 && assetId !== null && selectionSources[String(assetId)] === "scan";
|
|
820
890
|
}) : [];
|
|
891
|
+
const manualEditAmountByKey = /* @__PURE__ */ new Map();
|
|
892
|
+
if (preserveSelection) {
|
|
893
|
+
this.walletAssetsState.selectedItems.forEach((asset) => {
|
|
894
|
+
if (typeof (asset == null ? void 0 : asset.edit_current_amount) !== "number")
|
|
895
|
+
return;
|
|
896
|
+
manualEditAmountByKey.set(
|
|
897
|
+
getWalletAssetKey(asset),
|
|
898
|
+
asset.edit_current_amount
|
|
899
|
+
);
|
|
900
|
+
});
|
|
901
|
+
}
|
|
821
902
|
if (!((_a = businessData.products) == null ? void 0 : _a.length)) {
|
|
822
903
|
this.queuePendingAutoSelectForAssets(scanSelectedAssets);
|
|
823
904
|
this.generateWalletParams(businessData);
|
|
@@ -916,12 +997,16 @@ var WalletPassPaymentImpl = class {
|
|
|
916
997
|
searchedWalletAssets,
|
|
917
998
|
result.transformList || [],
|
|
918
999
|
result.noApplicableVoucher || []
|
|
919
|
-
).map((asset) =>
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1000
|
+
).map((asset) => {
|
|
1001
|
+
const assetKey = getWalletAssetKey(asset);
|
|
1002
|
+
return {
|
|
1003
|
+
...asset,
|
|
1004
|
+
...manualEditAmountByKey.has(assetKey) ? {
|
|
1005
|
+
edit_current_amount: manualEditAmountByKey.get(assetKey)
|
|
1006
|
+
} : {},
|
|
1007
|
+
_wallet_asset_recommended: recommendedKeys.has(assetKey)
|
|
1008
|
+
};
|
|
1009
|
+
});
|
|
925
1010
|
const latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
|
|
926
1011
|
const latestSelectionSources = preserveSelection ? { ...this.walletAssetsState.selectionSources } : {};
|
|
927
1012
|
const pendingAutoSelectAssets = this.walletAssetsBehavior.autoSelectAfterSearch ? items.filter(
|
|
@@ -1035,6 +1120,13 @@ var WalletPassPaymentImpl = class {
|
|
|
1035
1120
|
selectionSources: snapshot.state.selectionSources || {}
|
|
1036
1121
|
});
|
|
1037
1122
|
}
|
|
1123
|
+
updateWalletAssetEditAmountInCaches(assetKey, amount) {
|
|
1124
|
+
const updateAsset = (asset) => getWalletAssetKey(asset) === assetKey ? { ...asset, edit_current_amount: amount } : asset;
|
|
1125
|
+
this.searchResults = this.searchResults.map(
|
|
1126
|
+
updateAsset
|
|
1127
|
+
);
|
|
1128
|
+
return this.walletAssetsState.items.map(updateAsset);
|
|
1129
|
+
}
|
|
1038
1130
|
selectWalletAsset(assetId, options) {
|
|
1039
1131
|
const assetKey = String(assetId);
|
|
1040
1132
|
const asset = this.walletAssetsState.items.find(
|
|
@@ -1050,6 +1142,7 @@ var WalletPassPaymentImpl = class {
|
|
|
1050
1142
|
);
|
|
1051
1143
|
const selectionSources = { ...this.walletAssetsState.selectionSources };
|
|
1052
1144
|
delete selectionSources[assetKey];
|
|
1145
|
+
let nextItems = this.walletAssetsState.items;
|
|
1053
1146
|
if (options.selected) {
|
|
1054
1147
|
if (!asset || !isWalletAssetAvailable(asset)) {
|
|
1055
1148
|
return this.getWalletAssetsState();
|
|
@@ -1058,9 +1151,13 @@ var WalletPassPaymentImpl = class {
|
|
|
1058
1151
|
selectionSources[assetKey] = options.source || "manual";
|
|
1059
1152
|
} else if (asset) {
|
|
1060
1153
|
this.clearPendingAutoSelectForAsset(asset);
|
|
1154
|
+
nextItems = this.updateWalletAssetEditAmountInCaches(
|
|
1155
|
+
assetKey,
|
|
1156
|
+
void 0
|
|
1157
|
+
);
|
|
1061
1158
|
}
|
|
1062
1159
|
const nextState = this.recalculateWalletAssets(
|
|
1063
|
-
|
|
1160
|
+
nextItems,
|
|
1064
1161
|
selectedIds,
|
|
1065
1162
|
selectionSources
|
|
1066
1163
|
);
|
|
@@ -1069,6 +1166,54 @@ var WalletPassPaymentImpl = class {
|
|
|
1069
1166
|
}
|
|
1070
1167
|
return nextState;
|
|
1071
1168
|
}
|
|
1169
|
+
/**
|
|
1170
|
+
* 更新已选资产的手动金额。只允许在当前实际抵扣额内向下调整,
|
|
1171
|
+
* 金额为 0 时沿用 legacy 行为取消选择。
|
|
1172
|
+
*/
|
|
1173
|
+
updateWalletAssetAmount(assetId, amount) {
|
|
1174
|
+
const assetKey = String(assetId);
|
|
1175
|
+
const committedKeys = new Set(
|
|
1176
|
+
this.walletAssetsState.committedIds.map((id) => String(id))
|
|
1177
|
+
);
|
|
1178
|
+
const selectedKeys = new Set(
|
|
1179
|
+
this.walletAssetsState.selectedIds.map((id) => String(id))
|
|
1180
|
+
);
|
|
1181
|
+
const asset = this.walletAssetsState.items.find(
|
|
1182
|
+
(item) => getWalletAssetKey(item) === assetKey
|
|
1183
|
+
);
|
|
1184
|
+
const requestedAmount = Number(amount);
|
|
1185
|
+
if (!asset || committedKeys.has(assetKey) || !selectedKeys.has(assetKey) || !Number.isFinite(requestedAmount) || requestedAmount < 0) {
|
|
1186
|
+
return this.getWalletAssetsState();
|
|
1187
|
+
}
|
|
1188
|
+
const selectedIds = [...this.walletAssetsState.selectedIds];
|
|
1189
|
+
const selectionSources = { ...this.walletAssetsState.selectionSources };
|
|
1190
|
+
if (requestedAmount === 0) {
|
|
1191
|
+
const nextItems2 = this.updateWalletAssetEditAmountInCaches(
|
|
1192
|
+
assetKey,
|
|
1193
|
+
void 0
|
|
1194
|
+
);
|
|
1195
|
+
delete selectionSources[assetKey];
|
|
1196
|
+
this.clearPendingAutoSelectForAsset(asset);
|
|
1197
|
+
return this.recalculateWalletAssets(
|
|
1198
|
+
nextItems2,
|
|
1199
|
+
selectedIds.filter((id) => String(id) !== assetKey),
|
|
1200
|
+
selectionSources
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1203
|
+
const currentDeductionAmount = getWalletAssetDeductionAmount(asset);
|
|
1204
|
+
const editAmount = Math.min(requestedAmount, currentDeductionAmount);
|
|
1205
|
+
if (editAmount <= 0)
|
|
1206
|
+
return this.getWalletAssetsState();
|
|
1207
|
+
const nextItems = this.updateWalletAssetEditAmountInCaches(
|
|
1208
|
+
assetKey,
|
|
1209
|
+
editAmount
|
|
1210
|
+
);
|
|
1211
|
+
return this.recalculateWalletAssets(
|
|
1212
|
+
nextItems,
|
|
1213
|
+
selectedIds,
|
|
1214
|
+
selectionSources
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1072
1217
|
async scanWalletAssetAsync(code) {
|
|
1073
1218
|
const normalizedCode = String(code || "").trim();
|
|
1074
1219
|
if (!normalizedCode) {
|
|
@@ -1097,7 +1242,15 @@ var WalletPassPaymentImpl = class {
|
|
|
1097
1242
|
this.walletAssetsState.selectedItems
|
|
1098
1243
|
)
|
|
1099
1244
|
});
|
|
1100
|
-
const paymentAssets =
|
|
1245
|
+
const paymentAssets = this.formatSearchedWalletPaymentAssets(
|
|
1246
|
+
result.data.filter(isWalletPaymentAsset)
|
|
1247
|
+
);
|
|
1248
|
+
if (paymentAssets.length > 0) {
|
|
1249
|
+
this.searchResults = mergeWalletAssets(
|
|
1250
|
+
this.searchResults,
|
|
1251
|
+
paymentAssets
|
|
1252
|
+
);
|
|
1253
|
+
}
|
|
1101
1254
|
const asset = paymentAssets.find(
|
|
1102
1255
|
(item) => String((item == null ? void 0 : item.code) || "") === normalizedCode
|
|
1103
1256
|
) || paymentAssets[0];
|
|
@@ -1116,30 +1269,44 @@ var WalletPassPaymentImpl = class {
|
|
|
1116
1269
|
this.walletAssetsState.selectionSources
|
|
1117
1270
|
);
|
|
1118
1271
|
const assetId = getWalletAssetId(asset);
|
|
1119
|
-
const
|
|
1272
|
+
const recalculatedAsset = assetId === void 0 ? void 0 : recalculatedState.items.find(
|
|
1273
|
+
(item) => getWalletAssetKey(item) === String(assetId)
|
|
1274
|
+
);
|
|
1275
|
+
const selected = this.walletAssetsBehavior.autoSelectAfterSearch && assetId !== void 0 && isWalletAssetAvailable(recalculatedAsset) ? this.selectWalletAsset(assetId, {
|
|
1120
1276
|
selected: true,
|
|
1121
1277
|
source: "scan"
|
|
1122
1278
|
}) : recalculatedState;
|
|
1123
1279
|
const isSelected = assetId !== void 0 && selected.selectedIds.some((id) => String(id) === String(assetId));
|
|
1280
|
+
const selectedStateAsset = assetId === void 0 ? void 0 : selected.items.find(
|
|
1281
|
+
(item) => getWalletAssetKey(item) === String(assetId)
|
|
1282
|
+
);
|
|
1283
|
+
const resolvedAsset = selectedStateAsset || recalculatedAsset || asset;
|
|
1124
1284
|
if (isSelected) {
|
|
1125
|
-
this.clearPendingAutoSelectForAsset(
|
|
1285
|
+
this.clearPendingAutoSelectForAsset(resolvedAsset);
|
|
1126
1286
|
} else if (this.walletAssetsBehavior.autoSelectAfterSearch) {
|
|
1127
1287
|
this.pendingAutoSelectSearchCodes.add(
|
|
1128
1288
|
normalizeWalletAssetCode(normalizedCode)
|
|
1129
1289
|
);
|
|
1130
|
-
this.queuePendingAutoSelectForAssets([
|
|
1290
|
+
this.queuePendingAutoSelectForAssets([resolvedAsset]);
|
|
1131
1291
|
}
|
|
1132
1292
|
return {
|
|
1133
1293
|
type: result.type,
|
|
1134
|
-
asset,
|
|
1294
|
+
asset: resolvedAsset,
|
|
1135
1295
|
selected: isSelected,
|
|
1136
1296
|
state: selected
|
|
1137
1297
|
};
|
|
1138
1298
|
}
|
|
1139
1299
|
clearWalletAssetSelection() {
|
|
1140
1300
|
this.pendingAutoSelectSearchCodes.clear();
|
|
1301
|
+
const selectedKeys = new Set(
|
|
1302
|
+
this.walletAssetsState.selectedIds.map((id) => String(id))
|
|
1303
|
+
);
|
|
1304
|
+
const clearSelectedEditAmount = (asset) => selectedKeys.has(getWalletAssetKey(asset)) ? { ...asset, edit_current_amount: void 0 } : asset;
|
|
1305
|
+
this.searchResults = this.searchResults.map(
|
|
1306
|
+
clearSelectedEditAmount
|
|
1307
|
+
);
|
|
1141
1308
|
return this.recalculateWalletAssets(
|
|
1142
|
-
this.walletAssetsState.items,
|
|
1309
|
+
this.walletAssetsState.items.map(clearSelectedEditAmount),
|
|
1143
1310
|
[],
|
|
1144
1311
|
{}
|
|
1145
1312
|
);
|
package/lib/server/index.d.ts
CHANGED
|
@@ -253,6 +253,11 @@ declare class Server {
|
|
|
253
253
|
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
254
254
|
*/
|
|
255
255
|
private recomputeAndNotifySubscriber;
|
|
256
|
+
/**
|
|
257
|
+
* 根据餐牌 ID 获取其绑定日程中的全部时间点。
|
|
258
|
+
* 商品查询定时器与 schedule-time-points 路由共用此逻辑。
|
|
259
|
+
*/
|
|
260
|
+
private getMenuScheduleTimePoints;
|
|
256
261
|
/**
|
|
257
262
|
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
258
263
|
*/
|
package/lib/server/index.js
CHANGED
|
@@ -45,6 +45,7 @@ var import_floor_plan = require("./modules/floor-plan");
|
|
|
45
45
|
var import_types = require("./modules/floor-plan/types");
|
|
46
46
|
var import_payment = require("./modules/payment");
|
|
47
47
|
var import_schedule2 = require("./utils/schedule");
|
|
48
|
+
var import_time = require("./utils/time");
|
|
48
49
|
var import_types2 = require("./modules/products/types");
|
|
49
50
|
var import_product = require("./utils/product");
|
|
50
51
|
var import_order = require("./modules/order");
|
|
@@ -247,7 +248,11 @@ var Server = class {
|
|
|
247
248
|
strategy_context
|
|
248
249
|
});
|
|
249
250
|
if (subscriberId && typeof callback === "function") {
|
|
250
|
-
this.syncProductQueryScheduleTimers(
|
|
251
|
+
this.syncProductQueryScheduleTimers({
|
|
252
|
+
subscriberId,
|
|
253
|
+
menu_list_ids,
|
|
254
|
+
strategy_context
|
|
255
|
+
});
|
|
251
256
|
}
|
|
252
257
|
return result;
|
|
253
258
|
};
|
|
@@ -1074,7 +1079,12 @@ var Server = class {
|
|
|
1074
1079
|
};
|
|
1075
1080
|
}
|
|
1076
1081
|
try {
|
|
1077
|
-
const
|
|
1082
|
+
const {
|
|
1083
|
+
menuList,
|
|
1084
|
+
scheduleIds,
|
|
1085
|
+
scheduleList,
|
|
1086
|
+
timePoints
|
|
1087
|
+
} = this.getMenuScheduleTimePoints(menu_list_ids);
|
|
1078
1088
|
console.log(`[Server] 找到 ${menuList.length} 个餐牌`);
|
|
1079
1089
|
this.logInfo("handleGetScheduleTimePoints: 获取到餐牌列表", {
|
|
1080
1090
|
requestedCount: menu_list_ids.length,
|
|
@@ -1082,7 +1092,6 @@ var Server = class {
|
|
|
1082
1092
|
menu_list_ids,
|
|
1083
1093
|
menuList
|
|
1084
1094
|
});
|
|
1085
|
-
const scheduleIds = (0, import_schedule2.extractScheduleIdsFromMenus)(menuList);
|
|
1086
1095
|
console.log(`[Server] 提取到 ${scheduleIds.length} 个日程ID:`, scheduleIds);
|
|
1087
1096
|
this.logInfo("handleGetScheduleTimePoints: 提取到日程 IDs", {
|
|
1088
1097
|
scheduleCount: scheduleIds.length
|
|
@@ -1096,13 +1105,11 @@ var Server = class {
|
|
|
1096
1105
|
status: true
|
|
1097
1106
|
};
|
|
1098
1107
|
}
|
|
1099
|
-
const scheduleList = this.schedule.getScheduleByIds(scheduleIds);
|
|
1100
1108
|
console.log(`[Server] 找到 ${scheduleList.length} 个日程`);
|
|
1101
1109
|
this.logInfo("handleGetScheduleTimePoints: 获取到日程详情", {
|
|
1102
1110
|
requestedCount: scheduleIds.length,
|
|
1103
1111
|
foundCount: scheduleList.length
|
|
1104
1112
|
});
|
|
1105
|
-
const timePoints = (0, import_schedule2.extractTimePointsFromSchedules)(scheduleList);
|
|
1106
1113
|
console.log(`[Server] 提取到 ${timePoints.length} 个时间点:`, timePoints);
|
|
1107
1114
|
this.logInfo("handleGetScheduleTimePoints 处理完成", {
|
|
1108
1115
|
menuListIdsCount: menu_list_ids.length,
|
|
@@ -2264,16 +2271,44 @@ var Server = class {
|
|
|
2264
2271
|
});
|
|
2265
2272
|
}
|
|
2266
2273
|
}
|
|
2274
|
+
/**
|
|
2275
|
+
* 根据餐牌 ID 获取其绑定日程中的全部时间点。
|
|
2276
|
+
* 商品查询定时器与 schedule-time-points 路由共用此逻辑。
|
|
2277
|
+
*/
|
|
2278
|
+
getMenuScheduleTimePoints(menuListIds) {
|
|
2279
|
+
var _a, _b;
|
|
2280
|
+
const menuList = ((_a = this.menu) == null ? void 0 : _a.getMenuByIds(menuListIds)) ?? [];
|
|
2281
|
+
const scheduleIds = (0, import_schedule2.extractScheduleIdsFromMenus)(menuList);
|
|
2282
|
+
const scheduleList = scheduleIds.length > 0 ? ((_b = this.schedule) == null ? void 0 : _b.getScheduleByIds(scheduleIds)) ?? [] : [];
|
|
2283
|
+
const timePoints = (0, import_schedule2.extractTimePointsFromSchedules)(scheduleList);
|
|
2284
|
+
return {
|
|
2285
|
+
menuList,
|
|
2286
|
+
scheduleIds,
|
|
2287
|
+
scheduleList,
|
|
2288
|
+
timePoints
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2267
2291
|
/**
|
|
2268
2292
|
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
2269
2293
|
*/
|
|
2270
|
-
syncProductQueryScheduleTimers(
|
|
2294
|
+
syncProductQueryScheduleTimers({
|
|
2295
|
+
subscriberId,
|
|
2296
|
+
menu_list_ids,
|
|
2297
|
+
strategy_context
|
|
2298
|
+
}) {
|
|
2271
2299
|
var _a, _b;
|
|
2272
2300
|
this.clearSubscriberScheduleTimers(subscriberId);
|
|
2273
2301
|
if (!this.shouldScheduleProductQueryReload(strategy_context)) {
|
|
2274
2302
|
return;
|
|
2275
2303
|
}
|
|
2276
|
-
const
|
|
2304
|
+
const productTimePoints = ((_b = (_a = this.products) == null ? void 0 : _a.getLastScheduleTimePoints) == null ? void 0 : _b.call(_a)) ?? [];
|
|
2305
|
+
const menuListIds = Array.isArray(menu_list_ids) ? Array.from(new Set(
|
|
2306
|
+
menu_list_ids.map((id) => Number(id)).filter((id) => Number.isFinite(id))
|
|
2307
|
+
)) : [];
|
|
2308
|
+
const menuTimePoints = this.getMenuScheduleTimePoints(menuListIds).timePoints;
|
|
2309
|
+
const timePoints = (0, import_time.sortTimePoints)(
|
|
2310
|
+
Array.from(/* @__PURE__ */ new Set([...productTimePoints, ...menuTimePoints]))
|
|
2311
|
+
);
|
|
2277
2312
|
if (timePoints.length > 0) {
|
|
2278
2313
|
this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
|
|
2279
2314
|
}
|
|
@@ -355,6 +355,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
355
355
|
selected: boolean;
|
|
356
356
|
source?: WalletAssetSelectionSource;
|
|
357
357
|
}): Promise<WalletAssetsState>;
|
|
358
|
+
/** 更新已选钱包资产的手动使用金额,并同步 pending payment。 */
|
|
359
|
+
updateWalletAssetAmount(params: {
|
|
360
|
+
assetId: WalletAssetId;
|
|
361
|
+
amount: number;
|
|
362
|
+
}): Promise<WalletAssetsState>;
|
|
358
363
|
/** 扫码精确查券;仅可用资产会被自动选中。 */
|
|
359
364
|
scanWalletAsset(code: string): Promise<ScanWalletAssetResult>;
|
|
360
365
|
/** 清空全部未确认钱包选择,已支付钱包项由 Order 模块继续保留。 */
|
|
@@ -2638,11 +2638,27 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2638
2638
|
await this.syncSelectedWalletAssets(state);
|
|
2639
2639
|
return this.publishWalletAssetsState(state);
|
|
2640
2640
|
}
|
|
2641
|
+
/** 更新已选钱包资产的手动使用金额,并同步 pending payment。 */
|
|
2642
|
+
async updateWalletAssetAmount(params) {
|
|
2643
|
+
if (!this.store.payment)
|
|
2644
|
+
throw new Error("payment 模块未初始化");
|
|
2645
|
+
const state = this.store.payment.wallet.updateWalletAssetAmount(
|
|
2646
|
+
params.assetId,
|
|
2647
|
+
params.amount
|
|
2648
|
+
);
|
|
2649
|
+
await this.syncSelectedWalletAssets(state);
|
|
2650
|
+
return this.publishWalletAssetsState(state);
|
|
2651
|
+
}
|
|
2641
2652
|
/** 扫码精确查券;仅可用资产会被自动选中。 */
|
|
2642
2653
|
async scanWalletAsset(code) {
|
|
2643
2654
|
if (!this.store.payment)
|
|
2644
2655
|
throw new Error("payment 模块未初始化");
|
|
2645
|
-
const
|
|
2656
|
+
const wallet = this.store.payment.wallet;
|
|
2657
|
+
const businessData = this.buildWalletInitBusinessData();
|
|
2658
|
+
if (businessData) {
|
|
2659
|
+
wallet.generateWalletParams(businessData);
|
|
2660
|
+
}
|
|
2661
|
+
const result = await wallet.scanWalletAssetAsync(code);
|
|
2646
2662
|
if (result.type === "normalCode") {
|
|
2647
2663
|
await this.syncSelectedWalletAssets(result.state);
|
|
2648
2664
|
await this.publishWalletAssetsState(result.state);
|
|
@@ -217,7 +217,7 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
217
217
|
}
|
|
218
218
|
const productTitle = {
|
|
219
219
|
...(sourceProduct == null ? void 0 : sourceProduct.title_i18n) || {},
|
|
220
|
-
original: (sourceProduct == null ? void 0 : sourceProduct.title) || ""
|
|
220
|
+
original: (sourceProduct == null ? void 0 : sourceProduct.original_title) || (sourceProduct == null ? void 0 : sourceProduct.title) || ""
|
|
221
221
|
};
|
|
222
222
|
return {
|
|
223
223
|
product_id: productId,
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
326
326
|
* 获取当前的客户搜索条件
|
|
327
327
|
* @returns 当前搜索条件
|
|
328
328
|
*/
|
|
329
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
329
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
330
330
|
/**
|
|
331
331
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
332
332
|
* @returns 客户状态
|
|
@@ -1568,10 +1568,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1568
1568
|
});
|
|
1569
1569
|
}
|
|
1570
1570
|
if (typeof this.store.order.addProductsToOrder === "function") {
|
|
1571
|
-
return this.store.order.addProductsToOrder(orderLines
|
|
1572
|
-
skipEditDiscountConfigRefresh: true,
|
|
1573
|
-
skipDiscountRecalculation: true
|
|
1574
|
-
});
|
|
1571
|
+
return this.store.order.addProductsToOrder(orderLines);
|
|
1575
1572
|
}
|
|
1576
1573
|
const result = [];
|
|
1577
1574
|
for (const line of orderLines) {
|