@pisell/pisellos 2.3.38 → 2.3.39
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 +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +3 -7
- package/dist/solution/BookingTicket/index.js +49 -132
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +3 -7
- package/lib/solution/BookingTicket/index.js +9 -62
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -24,74 +24,6 @@ __export(walletpass_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(walletpass_exports);
|
|
25
25
|
var import_types = require("./types");
|
|
26
26
|
var import_utils = require("./utils");
|
|
27
|
-
var WALLET_PAYMENT_ASSET_TAGS = /* @__PURE__ */ new Set([
|
|
28
|
-
"product_voucher",
|
|
29
|
-
"gift_card",
|
|
30
|
-
"point_card"
|
|
31
|
-
]);
|
|
32
|
-
function isWalletPaymentAsset(asset) {
|
|
33
|
-
return WALLET_PAYMENT_ASSET_TAGS.has(
|
|
34
|
-
String((asset == null ? void 0 : asset.tag) || "").toLowerCase()
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
function getWalletAssetId(asset) {
|
|
38
|
-
return (asset == null ? void 0 : asset.id) ?? (asset == null ? void 0 : asset.voucher_id) ?? (asset == null ? void 0 : asset.code);
|
|
39
|
-
}
|
|
40
|
-
function getWalletAssetKey(assetOrId) {
|
|
41
|
-
const id = assetOrId && typeof assetOrId === "object" ? getWalletAssetId(assetOrId) : assetOrId;
|
|
42
|
-
return id === void 0 || id === null ? "" : String(id);
|
|
43
|
-
}
|
|
44
|
-
function isWalletAssetAvailable(asset) {
|
|
45
|
-
if (!asset)
|
|
46
|
-
return false;
|
|
47
|
-
if (asset.unified_available_status !== void 0 && Number(asset.unified_available_status) !== 1) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
if (asset._unified_available_status !== void 0 && Number(asset._unified_available_status) !== 1) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
if (asset.available === false || asset.isDisabled === true)
|
|
54
|
-
return false;
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
function getWalletAssetDeductionAmount(asset) {
|
|
58
|
-
const value = (asset == null ? void 0 : asset.actualDeduction) ?? (asset == null ? void 0 : asset._available_max_amount) ?? (asset == null ? void 0 : asset.edit_current_amount) ?? (asset == null ? void 0 : asset.recommended_usage_amount) ?? (asset == null ? void 0 : asset.available_max_amount) ?? (asset == null ? void 0 : asset.amount) ?? 0;
|
|
59
|
-
const amount = Number(value);
|
|
60
|
-
return Number.isFinite(amount) && amount > 0 ? amount : 0;
|
|
61
|
-
}
|
|
62
|
-
function mergeWalletAssets(...groups) {
|
|
63
|
-
const merged = [];
|
|
64
|
-
const indexByKey = /* @__PURE__ */ new Map();
|
|
65
|
-
groups.flat().forEach((asset) => {
|
|
66
|
-
const key = getWalletAssetKey(asset);
|
|
67
|
-
if (!key)
|
|
68
|
-
return;
|
|
69
|
-
const existedIndex = indexByKey.get(key);
|
|
70
|
-
if (existedIndex === void 0) {
|
|
71
|
-
indexByKey.set(key, merged.length);
|
|
72
|
-
merged.push(asset);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
merged[existedIndex] = {
|
|
76
|
-
...merged[existedIndex],
|
|
77
|
-
...asset
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
return merged;
|
|
81
|
-
}
|
|
82
|
-
function createInitialWalletAssetsState() {
|
|
83
|
-
return {
|
|
84
|
-
status: "idle",
|
|
85
|
-
items: [],
|
|
86
|
-
selectedIds: [],
|
|
87
|
-
selectedItems: [],
|
|
88
|
-
committedIds: [],
|
|
89
|
-
selectionSources: {},
|
|
90
|
-
totalSelectedAmount: 0,
|
|
91
|
-
error: null,
|
|
92
|
-
revision: 0
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
27
|
var WalletPassPaymentImpl = class {
|
|
96
28
|
constructor(paymentModule) {
|
|
97
29
|
this.paymentModule = paymentModule;
|
|
@@ -100,12 +32,6 @@ var WalletPassPaymentImpl = class {
|
|
|
100
32
|
this.searchResults = [];
|
|
101
33
|
this.walletParams = null;
|
|
102
34
|
this.walletInitData = null;
|
|
103
|
-
this.walletAssetsState = createInitialWalletAssetsState();
|
|
104
|
-
this.walletAssetsRequestSequence = 0;
|
|
105
|
-
this.walletAssetsCalculationContext = {
|
|
106
|
-
orderTotalAmount: 0,
|
|
107
|
-
products: []
|
|
108
|
-
};
|
|
109
35
|
}
|
|
110
36
|
/**
|
|
111
37
|
* 发送事件的辅助方法
|
|
@@ -122,145 +48,6 @@ var WalletPassPaymentImpl = class {
|
|
|
122
48
|
});
|
|
123
49
|
}
|
|
124
50
|
}
|
|
125
|
-
publishWalletAssetsState(patch) {
|
|
126
|
-
this.walletAssetsState = {
|
|
127
|
-
...this.walletAssetsState,
|
|
128
|
-
...patch,
|
|
129
|
-
items: [...patch.items ?? this.walletAssetsState.items],
|
|
130
|
-
selectedIds: [
|
|
131
|
-
...patch.selectedIds ?? this.walletAssetsState.selectedIds
|
|
132
|
-
],
|
|
133
|
-
selectedItems: [
|
|
134
|
-
...patch.selectedItems ?? this.walletAssetsState.selectedItems
|
|
135
|
-
],
|
|
136
|
-
committedIds: [
|
|
137
|
-
...patch.committedIds ?? this.walletAssetsState.committedIds
|
|
138
|
-
],
|
|
139
|
-
selectionSources: {
|
|
140
|
-
...patch.selectionSources ?? this.walletAssetsState.selectionSources
|
|
141
|
-
},
|
|
142
|
-
revision: this.walletAssetsState.revision + 1
|
|
143
|
-
};
|
|
144
|
-
const state = this.getWalletAssetsState();
|
|
145
|
-
this.emitEvent(import_types.WalletPassHooks.OnWalletAssetsStateChanged, { state });
|
|
146
|
-
return state;
|
|
147
|
-
}
|
|
148
|
-
recalculateWalletAssets(items, requestedIds, selectionSources) {
|
|
149
|
-
var _a, _b;
|
|
150
|
-
const committedKeys = new Set(
|
|
151
|
-
this.walletAssetsState.committedIds.map((id) => String(id))
|
|
152
|
-
);
|
|
153
|
-
const requestedKeys = new Set(
|
|
154
|
-
requestedIds.map((id) => String(id)).filter((id) => !committedKeys.has(id))
|
|
155
|
-
);
|
|
156
|
-
const requested = items.filter(
|
|
157
|
-
(item) => requestedKeys.has(getWalletAssetKey(item)) && isWalletAssetAvailable(item)
|
|
158
|
-
);
|
|
159
|
-
let nextItems = items;
|
|
160
|
-
let selectedItems = requested;
|
|
161
|
-
const evaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
|
|
162
|
-
if (evaluator == null ? void 0 : evaluator.recalculateVouchers) {
|
|
163
|
-
try {
|
|
164
|
-
const result = evaluator.recalculateVouchers(
|
|
165
|
-
items,
|
|
166
|
-
requested,
|
|
167
|
-
this.walletAssetsCalculationContext.orderTotalAmount,
|
|
168
|
-
this.walletAssetsCalculationContext.products
|
|
169
|
-
);
|
|
170
|
-
nextItems = mergeWalletAssets(items, (result == null ? void 0 : result.allWithUpdatedStatus) || []);
|
|
171
|
-
selectedItems = ((result == null ? void 0 : result.selectedWithDetails) || []).filter(
|
|
172
|
-
(item) => isWalletAssetAvailable(item) && getWalletAssetDeductionAmount(item) > 0
|
|
173
|
-
);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
this.paymentModule.logWarning(
|
|
176
|
-
"[WalletPass] 共享钱包资产重新计算失败,回退接口可用状态",
|
|
177
|
-
{
|
|
178
|
-
error: error instanceof Error ? error.message : String(error)
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const selectedIds = selectedItems.map((item) => getWalletAssetId(item)).filter((id) => id !== void 0 && id !== null);
|
|
184
|
-
const selectedKeys = new Set(selectedIds.map((id) => String(id)));
|
|
185
|
-
const nextSources = Object.entries(selectionSources).reduce((result, [key, source]) => {
|
|
186
|
-
if (selectedKeys.has(key))
|
|
187
|
-
result[key] = source;
|
|
188
|
-
return result;
|
|
189
|
-
}, {});
|
|
190
|
-
const totalSelectedAmount = selectedItems.reduce(
|
|
191
|
-
(total, item) => total + getWalletAssetDeductionAmount(item),
|
|
192
|
-
0
|
|
193
|
-
);
|
|
194
|
-
return this.publishWalletAssetsState({
|
|
195
|
-
status: "ready",
|
|
196
|
-
items: nextItems,
|
|
197
|
-
selectedIds,
|
|
198
|
-
selectedItems,
|
|
199
|
-
selectionSources: nextSources,
|
|
200
|
-
totalSelectedAmount,
|
|
201
|
-
error: null
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* 使用最新订单参数重验扫码搜索过的支付类 Wallet 资产。
|
|
206
|
-
* 请求失败或暂时无匹配结果时保留旧资产,避免商品变化造成列表闪空。
|
|
207
|
-
*/
|
|
208
|
-
async revalidateSearchedWalletAssets(requestSequence) {
|
|
209
|
-
const cachedAssets = this.searchResults.filter(isWalletPaymentAsset);
|
|
210
|
-
const searchCodes = [
|
|
211
|
-
...new Set(
|
|
212
|
-
cachedAssets.map((item) => String((item == null ? void 0 : item.code) || "").trim()).filter(Boolean)
|
|
213
|
-
)
|
|
214
|
-
];
|
|
215
|
-
if (searchCodes.length === 0)
|
|
216
|
-
return cachedAssets;
|
|
217
|
-
const preparePayments = this.formatWalletPassList2PreparePayments(
|
|
218
|
-
this.walletAssetsState.selectedItems
|
|
219
|
-
);
|
|
220
|
-
const refreshedGroups = await Promise.all(
|
|
221
|
-
searchCodes.map(async (searchCode) => {
|
|
222
|
-
try {
|
|
223
|
-
const result = await this.searchIdentificationCodeAsync(
|
|
224
|
-
{
|
|
225
|
-
...this.walletParams || {},
|
|
226
|
-
code: searchCode,
|
|
227
|
-
prepare_payments: preparePayments
|
|
228
|
-
},
|
|
229
|
-
{ noCache: true }
|
|
230
|
-
);
|
|
231
|
-
return {
|
|
232
|
-
searchCode,
|
|
233
|
-
items: result.type === "normalCode" ? result.data.filter(isWalletPaymentAsset) : []
|
|
234
|
-
};
|
|
235
|
-
} catch (error) {
|
|
236
|
-
this.paymentModule.logWarning(
|
|
237
|
-
"[WalletPass] 重验扫码 Wallet 资产失败,保留旧结果",
|
|
238
|
-
{
|
|
239
|
-
code: searchCode,
|
|
240
|
-
error: error instanceof Error ? error.message : String(error)
|
|
241
|
-
}
|
|
242
|
-
);
|
|
243
|
-
return { searchCode, items: [] };
|
|
244
|
-
}
|
|
245
|
-
})
|
|
246
|
-
);
|
|
247
|
-
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
248
|
-
return cachedAssets;
|
|
249
|
-
}
|
|
250
|
-
const replacedCodes = new Set(
|
|
251
|
-
refreshedGroups.filter((group) => group.items.length > 0).map((group) => group.searchCode.toUpperCase())
|
|
252
|
-
);
|
|
253
|
-
const refreshedAssets = refreshedGroups.flatMap((group) => group.items);
|
|
254
|
-
if (refreshedAssets.length > 0) {
|
|
255
|
-
this.searchResults = [
|
|
256
|
-
...this.searchResults.filter(
|
|
257
|
-
(item) => !replacedCodes.has(String((item == null ? void 0 : item.code) || "").trim().toUpperCase())
|
|
258
|
-
),
|
|
259
|
-
...refreshedAssets
|
|
260
|
-
];
|
|
261
|
-
}
|
|
262
|
-
return mergeWalletAssets(cachedAssets, refreshedAssets);
|
|
263
|
-
}
|
|
264
51
|
/**
|
|
265
52
|
* 生成钱包API默认参数
|
|
266
53
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
@@ -288,7 +75,7 @@ var WalletPassPaymentImpl = class {
|
|
|
288
75
|
// 订单小计金额
|
|
289
76
|
order_product_amount: subTotal,
|
|
290
77
|
// 订单待支付金额
|
|
291
|
-
order_wait_pay_amount: order_wait_pay_amount
|
|
78
|
+
order_wait_pay_amount: order_wait_pay_amount || ((amountInfo == null ? void 0 : amountInfo.isDeposit) ? Number(amountInfo == null ? void 0 : amountInfo.depositAmount) : totalAmount),
|
|
292
79
|
// order_behavior_count_customer_id: 1,
|
|
293
80
|
products,
|
|
294
81
|
prepare_payments: [],
|
|
@@ -569,6 +356,7 @@ var WalletPassPaymentImpl = class {
|
|
|
569
356
|
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
|
|
570
357
|
*/
|
|
571
358
|
async searchIdentificationCodeAsync(params, config = {}) {
|
|
359
|
+
var _a;
|
|
572
360
|
try {
|
|
573
361
|
const { code } = params;
|
|
574
362
|
this.paymentModule.logInfo("[WalletPass] 开始搜索识别码", {
|
|
@@ -606,14 +394,14 @@ var WalletPassPaymentImpl = class {
|
|
|
606
394
|
const baseWalletParams = this.walletParams;
|
|
607
395
|
const searchParams = {
|
|
608
396
|
// 基础钱包参数
|
|
609
|
-
sale_channel: params.sale_channel
|
|
610
|
-
customer_id: params.customer_id
|
|
611
|
-
order_expect_amount: params.order_expect_amount
|
|
612
|
-
order_product_amount: params.order_product_amount
|
|
613
|
-
order_wait_pay_amount: params.order_wait_pay_amount
|
|
614
|
-
order_behavior_count_customer_id: params.order_behavior_count_customer_id
|
|
615
|
-
products: params.products
|
|
616
|
-
prepare_payments: params.prepare_payments
|
|
397
|
+
sale_channel: params.sale_channel || (baseWalletParams == null ? void 0 : baseWalletParams.sale_channel) || "pos",
|
|
398
|
+
customer_id: params.customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.customer_id),
|
|
399
|
+
order_expect_amount: params.order_expect_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_expect_amount),
|
|
400
|
+
order_product_amount: params.order_product_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_product_amount),
|
|
401
|
+
order_wait_pay_amount: params.order_wait_pay_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_wait_pay_amount),
|
|
402
|
+
order_behavior_count_customer_id: params.order_behavior_count_customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.order_behavior_count_customer_id) || params.customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.customer_id),
|
|
403
|
+
products: params.products || (baseWalletParams == null ? void 0 : baseWalletParams.products),
|
|
404
|
+
prepare_payments: params.prepare_payments || (baseWalletParams == null ? void 0 : baseWalletParams.prepare_payments),
|
|
617
405
|
multiple: 1,
|
|
618
406
|
// 搜索特有参数
|
|
619
407
|
code: params.code,
|
|
@@ -629,10 +417,17 @@ var WalletPassPaymentImpl = class {
|
|
|
629
417
|
if (typeof searchParams.payment_order_id === "string" && searchParams.payment_order_id.startsWith("LOCAL_")) {
|
|
630
418
|
searchParams.payment_order_id = void 0;
|
|
631
419
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
420
|
+
let response;
|
|
421
|
+
if (!searchParams.products || ((_a = searchParams.products || []) == null ? void 0 : _a.length) === 0) {
|
|
422
|
+
response = {
|
|
423
|
+
data: []
|
|
424
|
+
};
|
|
425
|
+
} else {
|
|
426
|
+
response = await this.paymentModule.request.post(
|
|
427
|
+
"/machinecode/prepare/deduction/search",
|
|
428
|
+
searchParams
|
|
429
|
+
);
|
|
430
|
+
}
|
|
636
431
|
const searchResults = (response == null ? void 0 : response.data) || [];
|
|
637
432
|
if (config.noCache) {
|
|
638
433
|
return {
|
|
@@ -674,243 +469,6 @@ var WalletPassPaymentImpl = class {
|
|
|
674
469
|
throw error;
|
|
675
470
|
}
|
|
676
471
|
}
|
|
677
|
-
/**
|
|
678
|
-
* 刷新购物车与结账共享的钱包资产。
|
|
679
|
-
*
|
|
680
|
-
* 与 legacy initializeWalletDataFromBusinessAsync 不同,这里维护选择状态;
|
|
681
|
-
* 推荐结果只作为可用性/金额计算输入,不会自动成为 selectedIds。
|
|
682
|
-
*/
|
|
683
|
-
async refreshWalletAssetsFromBusinessAsync(businessData, options = {}) {
|
|
684
|
-
const requestSequence = ++this.walletAssetsRequestSequence;
|
|
685
|
-
const nextCustomerId = businessData.customer_id;
|
|
686
|
-
const previousCustomerId = this.walletAssetsState.customerId;
|
|
687
|
-
const customerChanged = String(previousCustomerId ?? "") !== String(nextCustomerId ?? "");
|
|
688
|
-
const preserveSelection = options.preserveSelection !== false && !customerChanged;
|
|
689
|
-
if (customerChanged) {
|
|
690
|
-
this.clearSearchResults();
|
|
691
|
-
}
|
|
692
|
-
const committedKeys = new Set(
|
|
693
|
-
this.walletAssetsState.committedIds.map((id) => String(id))
|
|
694
|
-
);
|
|
695
|
-
const committedItems = this.walletAssetsState.items.filter(
|
|
696
|
-
(item) => committedKeys.has(getWalletAssetKey(item))
|
|
697
|
-
);
|
|
698
|
-
const selectedIds = preserveSelection ? [...this.walletAssetsState.selectedIds] : [];
|
|
699
|
-
const selectionSources = preserveSelection ? { ...this.walletAssetsState.selectionSources } : {};
|
|
700
|
-
this.publishWalletAssetsState({
|
|
701
|
-
status: "loading",
|
|
702
|
-
customerId: nextCustomerId,
|
|
703
|
-
items: preserveSelection ? this.walletAssetsState.items : committedItems,
|
|
704
|
-
selectedIds,
|
|
705
|
-
selectedItems: preserveSelection ? this.walletAssetsState.selectedItems : [],
|
|
706
|
-
selectionSources,
|
|
707
|
-
totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
|
|
708
|
-
error: null
|
|
709
|
-
});
|
|
710
|
-
try {
|
|
711
|
-
const result = await this.initializeWalletDataFromBusinessAsync(
|
|
712
|
-
businessData
|
|
713
|
-
);
|
|
714
|
-
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
715
|
-
return this.getWalletAssetsState();
|
|
716
|
-
}
|
|
717
|
-
this.walletAssetsCalculationContext = {
|
|
718
|
-
orderTotalAmount: Number(businessData.order_wait_pay_amount || 0),
|
|
719
|
-
products: result.products || businessData.products || []
|
|
720
|
-
};
|
|
721
|
-
const searchedWalletAssets = preserveSelection ? await this.revalidateSearchedWalletAssets(requestSequence) : [];
|
|
722
|
-
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
723
|
-
return this.getWalletAssetsState();
|
|
724
|
-
}
|
|
725
|
-
const recommendedKeys = new Set(
|
|
726
|
-
(result.walletRecommendList || []).map(
|
|
727
|
-
(asset) => getWalletAssetKey(asset)
|
|
728
|
-
)
|
|
729
|
-
);
|
|
730
|
-
const items = mergeWalletAssets(
|
|
731
|
-
preserveSelection ? this.walletAssetsState.selectedItems : [],
|
|
732
|
-
searchedWalletAssets,
|
|
733
|
-
result.transformList || [],
|
|
734
|
-
result.noApplicableVoucher || []
|
|
735
|
-
).map((asset) => ({
|
|
736
|
-
...asset,
|
|
737
|
-
_wallet_asset_recommended: recommendedKeys.has(
|
|
738
|
-
getWalletAssetKey(asset)
|
|
739
|
-
)
|
|
740
|
-
}));
|
|
741
|
-
const latestSelectedIds = preserveSelection ? [...this.walletAssetsState.selectedIds] : [];
|
|
742
|
-
const latestSelectionSources = preserveSelection ? { ...this.walletAssetsState.selectionSources } : {};
|
|
743
|
-
return this.recalculateWalletAssets(
|
|
744
|
-
items,
|
|
745
|
-
latestSelectedIds,
|
|
746
|
-
latestSelectionSources
|
|
747
|
-
);
|
|
748
|
-
} catch (error) {
|
|
749
|
-
if (requestSequence !== this.walletAssetsRequestSequence) {
|
|
750
|
-
return this.getWalletAssetsState();
|
|
751
|
-
}
|
|
752
|
-
return this.publishWalletAssetsState({
|
|
753
|
-
status: "error",
|
|
754
|
-
items: preserveSelection ? this.walletAssetsState.items : committedItems,
|
|
755
|
-
selectedIds: preserveSelection ? this.walletAssetsState.selectedIds : [],
|
|
756
|
-
selectedItems: preserveSelection ? this.walletAssetsState.selectedItems : [],
|
|
757
|
-
selectionSources: preserveSelection ? this.walletAssetsState.selectionSources : {},
|
|
758
|
-
totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
|
|
759
|
-
customerId: nextCustomerId,
|
|
760
|
-
error: error instanceof Error ? error.message : String(error)
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
getWalletAssetsState() {
|
|
765
|
-
return {
|
|
766
|
-
...this.walletAssetsState,
|
|
767
|
-
items: [...this.walletAssetsState.items],
|
|
768
|
-
selectedIds: [...this.walletAssetsState.selectedIds],
|
|
769
|
-
selectedItems: [...this.walletAssetsState.selectedItems],
|
|
770
|
-
committedIds: [...this.walletAssetsState.committedIds],
|
|
771
|
-
selectionSources: { ...this.walletAssetsState.selectionSources }
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
exportWalletAssetsSnapshot() {
|
|
775
|
-
return {
|
|
776
|
-
state: this.getWalletAssetsState(),
|
|
777
|
-
searchResults: [...this.searchResults],
|
|
778
|
-
walletParams: this.walletParams ? { ...this.walletParams } : null,
|
|
779
|
-
calculationContext: {
|
|
780
|
-
orderTotalAmount: this.walletAssetsCalculationContext.orderTotalAmount,
|
|
781
|
-
products: [...this.walletAssetsCalculationContext.products]
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
}
|
|
785
|
-
importWalletAssetsSnapshot(snapshot) {
|
|
786
|
-
var _a, _b;
|
|
787
|
-
if (!(snapshot == null ? void 0 : snapshot.state))
|
|
788
|
-
return this.getWalletAssetsState();
|
|
789
|
-
this.walletAssetsRequestSequence += 1;
|
|
790
|
-
this.searchResults = Array.isArray(snapshot.searchResults) ? [...snapshot.searchResults] : [];
|
|
791
|
-
this.walletParams = snapshot.walletParams ? { ...snapshot.walletParams } : null;
|
|
792
|
-
this.walletAssetsCalculationContext = {
|
|
793
|
-
orderTotalAmount: Number(
|
|
794
|
-
((_a = snapshot.calculationContext) == null ? void 0 : _a.orderTotalAmount) || 0
|
|
795
|
-
),
|
|
796
|
-
products: Array.isArray((_b = snapshot.calculationContext) == null ? void 0 : _b.products) ? [...snapshot.calculationContext.products] : []
|
|
797
|
-
};
|
|
798
|
-
return this.publishWalletAssetsState({
|
|
799
|
-
...snapshot.state,
|
|
800
|
-
items: Array.isArray(snapshot.state.items) ? snapshot.state.items : [],
|
|
801
|
-
selectedIds: Array.isArray(snapshot.state.selectedIds) ? snapshot.state.selectedIds : [],
|
|
802
|
-
selectedItems: Array.isArray(snapshot.state.selectedItems) ? snapshot.state.selectedItems : [],
|
|
803
|
-
committedIds: Array.isArray(snapshot.state.committedIds) ? snapshot.state.committedIds : [],
|
|
804
|
-
selectionSources: snapshot.state.selectionSources || {}
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
selectWalletAsset(assetId, options) {
|
|
808
|
-
const assetKey = String(assetId);
|
|
809
|
-
const committedKeys = new Set(
|
|
810
|
-
this.walletAssetsState.committedIds.map((id) => String(id))
|
|
811
|
-
);
|
|
812
|
-
if (committedKeys.has(assetKey))
|
|
813
|
-
return this.getWalletAssetsState();
|
|
814
|
-
const selectedIds = this.walletAssetsState.selectedIds.filter(
|
|
815
|
-
(id) => String(id) !== assetKey
|
|
816
|
-
);
|
|
817
|
-
const selectionSources = { ...this.walletAssetsState.selectionSources };
|
|
818
|
-
delete selectionSources[assetKey];
|
|
819
|
-
if (options.selected) {
|
|
820
|
-
const asset = this.walletAssetsState.items.find(
|
|
821
|
-
(item) => getWalletAssetKey(item) === assetKey
|
|
822
|
-
);
|
|
823
|
-
if (!asset || !isWalletAssetAvailable(asset)) {
|
|
824
|
-
return this.getWalletAssetsState();
|
|
825
|
-
}
|
|
826
|
-
selectedIds.push(assetId);
|
|
827
|
-
selectionSources[assetKey] = options.source || "manual";
|
|
828
|
-
}
|
|
829
|
-
return this.recalculateWalletAssets(
|
|
830
|
-
this.walletAssetsState.items,
|
|
831
|
-
selectedIds,
|
|
832
|
-
selectionSources
|
|
833
|
-
);
|
|
834
|
-
}
|
|
835
|
-
async scanWalletAssetAsync(code) {
|
|
836
|
-
const normalizedCode = String(code || "").trim();
|
|
837
|
-
if (!normalizedCode) {
|
|
838
|
-
return {
|
|
839
|
-
type: "normalCode",
|
|
840
|
-
selected: false,
|
|
841
|
-
state: this.getWalletAssetsState()
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
this.walletAssetsRequestSequence += 1;
|
|
845
|
-
const result = await this.searchIdentificationCodeAsync({
|
|
846
|
-
...this.walletParams || {},
|
|
847
|
-
code: normalizedCode,
|
|
848
|
-
prepare_payments: this.formatWalletPassList2PreparePayments(
|
|
849
|
-
this.walletAssetsState.selectedItems
|
|
850
|
-
)
|
|
851
|
-
});
|
|
852
|
-
const paymentAssets = result.data.filter(isWalletPaymentAsset);
|
|
853
|
-
const asset = paymentAssets.find(
|
|
854
|
-
(item) => String((item == null ? void 0 : item.code) || "") === normalizedCode
|
|
855
|
-
) || paymentAssets[0];
|
|
856
|
-
if (!asset || result.type === "walletCode") {
|
|
857
|
-
return {
|
|
858
|
-
type: result.type,
|
|
859
|
-
asset,
|
|
860
|
-
selected: false,
|
|
861
|
-
state: this.getWalletAssetsState()
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
const items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
|
|
865
|
-
this.recalculateWalletAssets(
|
|
866
|
-
items,
|
|
867
|
-
this.walletAssetsState.selectedIds,
|
|
868
|
-
this.walletAssetsState.selectionSources
|
|
869
|
-
);
|
|
870
|
-
const assetId = getWalletAssetId(asset);
|
|
871
|
-
const selected = assetId !== void 0 && isWalletAssetAvailable(asset) ? this.selectWalletAsset(assetId, {
|
|
872
|
-
selected: true,
|
|
873
|
-
source: "scan"
|
|
874
|
-
}) : this.getWalletAssetsState();
|
|
875
|
-
return {
|
|
876
|
-
type: result.type,
|
|
877
|
-
asset,
|
|
878
|
-
selected: assetId !== void 0 && selected.selectedIds.some((id) => String(id) === String(assetId)),
|
|
879
|
-
state: selected
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
clearWalletAssetSelection() {
|
|
883
|
-
return this.recalculateWalletAssets(
|
|
884
|
-
this.walletAssetsState.items,
|
|
885
|
-
[],
|
|
886
|
-
{}
|
|
887
|
-
);
|
|
888
|
-
}
|
|
889
|
-
setCommittedWalletAssets(committedIds, committedAssets = []) {
|
|
890
|
-
const committedKeys = new Set(committedIds.map((id) => String(id)));
|
|
891
|
-
const selectedIds = this.walletAssetsState.selectedIds.filter(
|
|
892
|
-
(id) => !committedKeys.has(String(id))
|
|
893
|
-
);
|
|
894
|
-
const selectionSources = Object.entries(
|
|
895
|
-
this.walletAssetsState.selectionSources
|
|
896
|
-
).reduce(
|
|
897
|
-
(result, [key, source]) => {
|
|
898
|
-
if (!committedKeys.has(key))
|
|
899
|
-
result[key] = source;
|
|
900
|
-
return result;
|
|
901
|
-
},
|
|
902
|
-
{}
|
|
903
|
-
);
|
|
904
|
-
this.publishWalletAssetsState({
|
|
905
|
-
items: mergeWalletAssets(this.walletAssetsState.items, committedAssets),
|
|
906
|
-
committedIds
|
|
907
|
-
});
|
|
908
|
-
return this.recalculateWalletAssets(
|
|
909
|
-
this.walletAssetsState.items,
|
|
910
|
-
selectedIds,
|
|
911
|
-
selectionSources
|
|
912
|
-
);
|
|
913
|
-
}
|
|
914
472
|
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
915
473
|
this.paymentModule.logInfo("[WalletPass] 开始处理钱包支付", {
|
|
916
474
|
amount,
|
|
@@ -1018,13 +576,6 @@ var WalletPassPaymentImpl = class {
|
|
|
1018
576
|
this.searchResults = [];
|
|
1019
577
|
this.walletParams = null;
|
|
1020
578
|
this.walletInitData = null;
|
|
1021
|
-
this.walletAssetsRequestSequence += 1;
|
|
1022
|
-
this.walletAssetsCalculationContext = {
|
|
1023
|
-
orderTotalAmount: 0,
|
|
1024
|
-
products: []
|
|
1025
|
-
};
|
|
1026
|
-
this.walletAssetsState = createInitialWalletAssetsState();
|
|
1027
|
-
this.publishWalletAssetsState({});
|
|
1028
579
|
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
1029
580
|
clearedTypes: ["all"]
|
|
1030
581
|
});
|
|
@@ -106,39 +106,48 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
106
106
|
} catch (error) {
|
|
107
107
|
console.error(error);
|
|
108
108
|
}
|
|
109
|
+
const channelMap = {
|
|
110
|
+
online_store: "online-store",
|
|
111
|
+
scan_to_order: "online-store",
|
|
112
|
+
"scan-to-order": "online-store",
|
|
113
|
+
scan_to_order_2: "mobile_order",
|
|
114
|
+
scan_to_order_3: "scantoorder3"
|
|
115
|
+
};
|
|
116
|
+
const rawApplicationCode = (_b = this.otherParams) == null ? void 0 : _b.channel;
|
|
117
|
+
const mappedApplicationCode = typeof rawApplicationCode === "string" ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
118
|
+
const queryPayload = {
|
|
119
|
+
open_quotation: 1,
|
|
120
|
+
open_bundle: 0,
|
|
121
|
+
exclude_extension_type: [
|
|
122
|
+
"product_party",
|
|
123
|
+
"product_event",
|
|
124
|
+
"product_series_event",
|
|
125
|
+
"product_package_ticket",
|
|
126
|
+
"ticket",
|
|
127
|
+
"event_item"
|
|
128
|
+
],
|
|
129
|
+
with: ["category", "collection", "resourceRelation"],
|
|
130
|
+
status,
|
|
131
|
+
num: 500,
|
|
132
|
+
skip: 1,
|
|
133
|
+
customer_id,
|
|
134
|
+
...Array.isArray(category_ids) && category_ids.length ? { category_ids } : {},
|
|
135
|
+
...Array.isArray(product_ids) && product_ids.length ? { ids: product_ids } : {},
|
|
136
|
+
...Array.isArray(collection) && collection.length ? { collection } : {},
|
|
137
|
+
front_end_cache_id: cacheId,
|
|
138
|
+
...Array.isArray(menu_list_ids) && menu_list_ids.length ? { menu_list_ids } : {},
|
|
139
|
+
with_count,
|
|
140
|
+
// client_schedule_ids: schedule_ids,
|
|
141
|
+
schedule_date,
|
|
142
|
+
application_code: mappedApplicationCode,
|
|
143
|
+
is_eject: 1,
|
|
144
|
+
with_schedule,
|
|
145
|
+
schedule_datetime,
|
|
146
|
+
extension_type
|
|
147
|
+
};
|
|
109
148
|
const productsData = await this.request.post(
|
|
110
149
|
`/product/query`,
|
|
111
|
-
|
|
112
|
-
open_quotation: 1,
|
|
113
|
-
open_bundle: 0,
|
|
114
|
-
exclude_extension_type: [
|
|
115
|
-
"product_party",
|
|
116
|
-
"product_event",
|
|
117
|
-
"product_series_event",
|
|
118
|
-
"product_package_ticket",
|
|
119
|
-
"ticket",
|
|
120
|
-
"event_item"
|
|
121
|
-
],
|
|
122
|
-
with: ["category", "collection", "resourceRelation"],
|
|
123
|
-
status,
|
|
124
|
-
num: 500,
|
|
125
|
-
skip: 1,
|
|
126
|
-
customer_id,
|
|
127
|
-
category_ids,
|
|
128
|
-
ids: product_ids,
|
|
129
|
-
collection,
|
|
130
|
-
front_end_cache_id: cacheId,
|
|
131
|
-
menu_list_ids,
|
|
132
|
-
with_count,
|
|
133
|
-
// client_schedule_ids: schedule_ids,
|
|
134
|
-
schedule_date,
|
|
135
|
-
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
|
|
136
|
-
is_eject: 1,
|
|
137
|
-
with_schedule,
|
|
138
|
-
schedule_datetime,
|
|
139
|
-
extension_type,
|
|
140
|
-
strategy_context
|
|
141
|
-
},
|
|
150
|
+
queryPayload,
|
|
142
151
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
143
152
|
} }
|
|
144
153
|
);
|
|
@@ -21,7 +21,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
21
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
22
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
23
23
|
*
|
|
24
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
24
|
+
* Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
|
|
25
25
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
26
26
|
* the requested productId wins.
|
|
27
27
|
*/
|
|
@@ -52,7 +52,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
52
52
|
{ useCache: false, osServer: true }
|
|
53
53
|
);
|
|
54
54
|
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
|
|
55
|
-
list.sort((a, b) =>
|
|
55
|
+
list.sort((a, b) => b.sort - a.sort);
|
|
56
56
|
this.store.list = list;
|
|
57
57
|
}
|
|
58
58
|
getQuotationList() {
|
|
@@ -96,7 +96,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
97
97
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
98
98
|
*
|
|
99
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
99
|
+
* Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
|
|
100
100
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
101
101
|
* the requested productId wins.
|
|
102
102
|
*/
|