@pisell/pisellos 2.1.126 → 2.1.128
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/itemRule/adapter.js +6 -2
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +15 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +68 -1
- package/dist/model/strategy/adapter/itemRule/index.d.ts +1 -1
- package/dist/model/strategy/adapter/itemRule/index.js +1 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +9 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +9 -40
- package/dist/modules/Order/utils.d.ts +25 -1
- package/dist/modules/Order/utils.js +88 -12
- package/dist/modules/SalesSummary/types.d.ts +2 -1
- package/dist/modules/SalesSummary/utils.js +10 -10
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/index.d.ts +5 -0
- package/dist/solution/ScanOrder/index.js +181 -62
- package/dist/solution/ScanOrder/types.d.ts +19 -5
- package/dist/solution/ScanOrder/utils.d.ts +14 -0
- package/dist/solution/ScanOrder/utils.js +138 -63
- package/dist/solution/VenueBooking/index.js +42 -44
- package/lib/model/strategy/adapter/itemRule/adapter.js +10 -2
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +15 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +47 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +1 -1
- package/lib/model/strategy/adapter/itemRule/index.js +2 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +9 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +8 -41
- package/lib/modules/Order/utils.d.ts +25 -1
- package/lib/modules/Order/utils.js +66 -5
- package/lib/modules/SalesSummary/types.d.ts +2 -1
- package/lib/modules/SalesSummary/utils.js +2 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/index.d.ts +5 -0
- package/lib/solution/ScanOrder/index.js +78 -19
- package/lib/solution/ScanOrder/types.d.ts +19 -5
- package/lib/solution/ScanOrder/utils.d.ts +14 -0
- package/lib/solution/ScanOrder/utils.js +82 -20
- package/lib/solution/VenueBooking/index.js +11 -16
- package/package.json +1 -1
|
@@ -36,9 +36,10 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
|
36
36
|
order_detail_id: number | null;
|
|
37
37
|
num: number;
|
|
38
38
|
product_option_item: any[];
|
|
39
|
+
/** 券后单品单价(= 订单域实际成交单价)。未应用券时等同 original_price。 */
|
|
39
40
|
selling_price: string;
|
|
41
|
+
/** 券前单品单价(= 店铺售价),不承载后台划线价语义。 */
|
|
40
42
|
original_price: string;
|
|
41
|
-
payment_price: string;
|
|
42
43
|
tax_fee: string;
|
|
43
44
|
is_charge_tax: number;
|
|
44
45
|
discount_list: any[];
|
|
@@ -47,6 +48,11 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
|
47
48
|
_origin?: Record<string, any>;
|
|
48
49
|
}
|
|
49
50
|
export interface ScanOrderSubmitProduct extends Omit<ScanOrderOrderProduct, '_origin' | 'identity_key'> {
|
|
51
|
+
/**
|
|
52
|
+
* 出站兼容字段:SDK 内部不再消费 payment_price,
|
|
53
|
+
* 仅在提交后端时由 selling_price 派生,保持原有后端契约。
|
|
54
|
+
*/
|
|
55
|
+
payment_price: string;
|
|
50
56
|
}
|
|
51
57
|
export interface ScanOrderSummary {
|
|
52
58
|
product_quantity: number;
|
|
@@ -133,6 +139,11 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
|
|
|
133
139
|
products: ScanOrderSubmitProduct[];
|
|
134
140
|
}
|
|
135
141
|
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'resource_block' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
142
|
+
export interface ScanOrderTableFormRecord {
|
|
143
|
+
policy?: string | null;
|
|
144
|
+
partyroom_booking?: string | null;
|
|
145
|
+
[key: string]: any;
|
|
146
|
+
}
|
|
136
147
|
export interface ScanOrderAvailabilityInfo {
|
|
137
148
|
mode: ScanOrderAvailabilityMode;
|
|
138
149
|
order_id?: string;
|
|
@@ -140,10 +151,16 @@ export interface ScanOrderAvailabilityInfo {
|
|
|
140
151
|
table_form_id?: string;
|
|
141
152
|
deskmate_valid?: boolean;
|
|
142
153
|
errorTips?: string;
|
|
154
|
+
/** `/order/dining/table/config` 返回的 `table_form_record` 原样透出 */
|
|
155
|
+
table_form_record?: ScanOrderTableFormRecord | null;
|
|
143
156
|
policy?: string | null;
|
|
144
157
|
partyroom_booking?: string | null;
|
|
145
158
|
/** 预约规则关联商品存在 custom 容量时,由 checkResourceAvailable 置为 1 */
|
|
146
159
|
requestEntryPax?: number;
|
|
160
|
+
/** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 min(人数下限) */
|
|
161
|
+
requestPaxMin?: number;
|
|
162
|
+
/** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 max(人数上限) */
|
|
163
|
+
requestPaxMax?: number;
|
|
147
164
|
}
|
|
148
165
|
export interface ScanOrderTableSnackConfig {
|
|
149
166
|
snack?: boolean | number | string;
|
|
@@ -153,9 +170,6 @@ export interface ScanOrderOrderNumberPrefixConfig {
|
|
|
153
170
|
table_order?: string;
|
|
154
171
|
pos?: string;
|
|
155
172
|
}
|
|
156
|
-
export interface ScanOrderTableFormRecord {
|
|
157
|
-
policy?: string | null;
|
|
158
|
-
}
|
|
159
173
|
export interface ScanOrderTableConfigApiData {
|
|
160
174
|
table_max_number?: number | string | null;
|
|
161
175
|
order_count?: number | string | null;
|
|
@@ -186,7 +200,6 @@ export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
|
|
|
186
200
|
isFull: boolean;
|
|
187
201
|
orderNumberPrefix: ScanOrderOrderNumberPrefixConfig[];
|
|
188
202
|
raw: ScanOrderTableConfigApiData | null;
|
|
189
|
-
table_form_record?: ScanOrderTableFormRecord | null;
|
|
190
203
|
}
|
|
191
204
|
export interface ScanOrderState {
|
|
192
205
|
entryContext: ScanOrderEntryContext | null;
|
|
@@ -204,6 +217,7 @@ export interface ScanOrderState {
|
|
|
204
217
|
passed: boolean | null;
|
|
205
218
|
failures: QuantityCheckResult[];
|
|
206
219
|
};
|
|
220
|
+
entryPaxNumber: number | null;
|
|
207
221
|
}
|
|
208
222
|
export interface ScanOrderLoggerRuntimeConfig {
|
|
209
223
|
provider?: ScanOrderLoggerProviderType;
|
|
@@ -62,6 +62,12 @@ export declare function aggregateItemRuleLimit(matchedLimits: QuantityLimitResul
|
|
|
62
62
|
remainingMax: number | undefined;
|
|
63
63
|
exact: number | undefined;
|
|
64
64
|
mustInclude: boolean;
|
|
65
|
+
validationMessage: string | undefined;
|
|
66
|
+
rawValidationMessage: string | Record<string, string> | undefined;
|
|
67
|
+
maxValidationMessage: string | undefined;
|
|
68
|
+
rawMaxValidationMessage: string | Record<string, string> | undefined;
|
|
69
|
+
minValidationMessage: string | undefined;
|
|
70
|
+
rawMinValidationMessage: string | Record<string, string> | undefined;
|
|
65
71
|
} | null;
|
|
66
72
|
export declare function buildItemRuleBusinessData(params: {
|
|
67
73
|
tempOrder: ScanOrderTempOrder;
|
|
@@ -103,3 +109,11 @@ export declare function collectLinkProductIdsFromReservationRules(rules: unknown
|
|
|
103
109
|
export declare function pickFirstDurationMinutesFromProducts(products: ProductData[]): number | undefined;
|
|
104
110
|
/** 是否存在 capacity.type === 'custom' 的商品 */
|
|
105
111
|
export declare function hasCustomCapacityProduct(products: ProductData[]): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 在商品列表中找到第一个 `capacity.type === 'custom'` 的商品,取其 `custom` 数组第一项的 min/max。
|
|
114
|
+
* 仅返回有限数字字段;若均无法解析则返回 `undefined`。
|
|
115
|
+
*/
|
|
116
|
+
export declare function pickFirstCustomCapacityPaxBounds(products: ProductData[]): {
|
|
117
|
+
min?: number;
|
|
118
|
+
max?: number;
|
|
119
|
+
} | undefined;
|
|
@@ -36,6 +36,7 @@ __export(utils_exports, {
|
|
|
36
36
|
normalizeEnabledItemRuleIds: () => normalizeEnabledItemRuleIds,
|
|
37
37
|
normalizeItemRuleStrategies: () => normalizeItemRuleStrategies,
|
|
38
38
|
normalizeOrderProduct: () => normalizeOrderProduct,
|
|
39
|
+
pickFirstCustomCapacityPaxBounds: () => pickFirstCustomCapacityPaxBounds,
|
|
39
40
|
pickFirstDurationMinutesFromProducts: () => pickFirstDurationMinutesFromProducts,
|
|
40
41
|
resolveSkuMatchedQuantityLimits: () => resolveSkuMatchedQuantityLimits,
|
|
41
42
|
toBoolean: () => toBoolean,
|
|
@@ -163,18 +164,20 @@ function buildQuantityLimitIndex(limits) {
|
|
|
163
164
|
const exactLimitMap = /* @__PURE__ */ new Map();
|
|
164
165
|
const productLimitMap = /* @__PURE__ */ new Map();
|
|
165
166
|
for (const limit of limits) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
167
|
+
const targets = limit.targets || [];
|
|
168
|
+
if (targets.length !== 1)
|
|
169
|
+
continue;
|
|
170
|
+
const target = targets[0];
|
|
171
|
+
const productId = Number(target.product_id);
|
|
172
|
+
if (!Number.isFinite(productId) || productId <= 0)
|
|
173
|
+
continue;
|
|
174
|
+
const variantId = Number(target.product_variant_id);
|
|
175
|
+
const hasVariant = Number.isFinite(variantId) && variantId > 0;
|
|
176
|
+
if (hasVariant) {
|
|
177
|
+
const exactKey = buildProductKey(productId, variantId);
|
|
178
|
+
const existed = exactLimitMap.get(exactKey) || [];
|
|
179
|
+
exactLimitMap.set(exactKey, [...existed, limit]);
|
|
180
|
+
} else {
|
|
178
181
|
const existed = productLimitMap.get(productId) || [];
|
|
179
182
|
productLimitMap.set(productId, [...existed, limit]);
|
|
180
183
|
}
|
|
@@ -198,31 +201,63 @@ function aggregateItemRuleLimit(matchedLimits) {
|
|
|
198
201
|
let remainingMax;
|
|
199
202
|
let exact;
|
|
200
203
|
let mustInclude = false;
|
|
204
|
+
let maxSourceLimit;
|
|
205
|
+
let remainingMaxSourceLimit;
|
|
206
|
+
let exactSourceLimit;
|
|
207
|
+
let minSourceLimit;
|
|
208
|
+
let firstMessagedLimit;
|
|
201
209
|
for (const limit of matchedLimits) {
|
|
202
210
|
if (typeof limit.requiredMin === "number" && Number.isFinite(limit.requiredMin)) {
|
|
203
|
-
|
|
211
|
+
if (min === void 0 || limit.requiredMin > min) {
|
|
212
|
+
min = limit.requiredMin;
|
|
213
|
+
minSourceLimit = limit;
|
|
214
|
+
}
|
|
204
215
|
}
|
|
205
216
|
if (typeof limit.requiredMax === "number" && Number.isFinite(limit.requiredMax)) {
|
|
206
|
-
|
|
217
|
+
if (max === void 0 || limit.requiredMax < max) {
|
|
218
|
+
max = limit.requiredMax;
|
|
219
|
+
maxSourceLimit = limit;
|
|
220
|
+
}
|
|
207
221
|
}
|
|
208
222
|
if (typeof limit.remainingMax === "number" && Number.isFinite(limit.remainingMax)) {
|
|
209
|
-
|
|
223
|
+
if (remainingMax === void 0 || limit.remainingMax < remainingMax) {
|
|
224
|
+
remainingMax = limit.remainingMax;
|
|
225
|
+
remainingMaxSourceLimit = limit;
|
|
226
|
+
}
|
|
210
227
|
}
|
|
211
228
|
if (typeof limit.requiredExact === "number" && Number.isFinite(limit.requiredExact)) {
|
|
212
229
|
exact = limit.requiredExact;
|
|
230
|
+
exactSourceLimit = limit;
|
|
213
231
|
}
|
|
214
232
|
mustInclude = mustInclude || Boolean(limit.mustInclude);
|
|
233
|
+
if (!firstMessagedLimit && limit.validationMessage) {
|
|
234
|
+
firstMessagedLimit = limit;
|
|
235
|
+
}
|
|
215
236
|
}
|
|
216
237
|
if (typeof exact === "number" && Number.isFinite(exact)) {
|
|
217
238
|
min = exact;
|
|
218
239
|
max = exact;
|
|
219
240
|
}
|
|
241
|
+
const maxMessageSource = maxSourceLimit || remainingMaxSourceLimit || exactSourceLimit || firstMessagedLimit;
|
|
242
|
+
const minMessageSource = minSourceLimit || exactSourceLimit || firstMessagedLimit;
|
|
243
|
+
const maxValidationMessage = maxMessageSource == null ? void 0 : maxMessageSource.validationMessage;
|
|
244
|
+
const rawMaxValidationMessage = maxMessageSource == null ? void 0 : maxMessageSource.rawValidationMessage;
|
|
245
|
+
const minValidationMessage = minMessageSource == null ? void 0 : minMessageSource.validationMessage;
|
|
246
|
+
const rawMinValidationMessage = minMessageSource == null ? void 0 : minMessageSource.rawValidationMessage;
|
|
247
|
+
const validationMessage = maxValidationMessage ?? minValidationMessage;
|
|
248
|
+
const rawValidationMessage = rawMaxValidationMessage ?? rawMinValidationMessage;
|
|
220
249
|
return {
|
|
221
250
|
min,
|
|
222
251
|
max,
|
|
223
252
|
remainingMax,
|
|
224
253
|
exact,
|
|
225
|
-
mustInclude
|
|
254
|
+
mustInclude,
|
|
255
|
+
validationMessage,
|
|
256
|
+
rawValidationMessage,
|
|
257
|
+
maxValidationMessage,
|
|
258
|
+
rawMaxValidationMessage,
|
|
259
|
+
minValidationMessage,
|
|
260
|
+
rawMinValidationMessage
|
|
226
261
|
};
|
|
227
262
|
}
|
|
228
263
|
function buildItemRuleBusinessData(params) {
|
|
@@ -302,13 +337,13 @@ function getProductIdentityIndex(products, identity) {
|
|
|
302
337
|
return products.findIndex((item) => isIdentityMatch(item, identity));
|
|
303
338
|
}
|
|
304
339
|
function normalizeOrderProduct(product) {
|
|
305
|
-
var _a;
|
|
340
|
+
var _a, _b;
|
|
306
341
|
const metadata = { ...product.metadata || {} };
|
|
307
342
|
if (product.identity_key && !metadata.unique_identification_number) {
|
|
308
343
|
metadata.unique_identification_number = product.identity_key;
|
|
309
344
|
}
|
|
310
|
-
const resolvedOriginalPrice = product.original_price || "0.00";
|
|
311
345
|
const resolvedSellingPrice = product.selling_price || "0.00";
|
|
346
|
+
const resolvedOriginalPrice = product.original_price || resolvedSellingPrice;
|
|
312
347
|
if (metadata.main_product_original_price === void 0) {
|
|
313
348
|
metadata.main_product_original_price = resolvedOriginalPrice;
|
|
314
349
|
}
|
|
@@ -316,7 +351,7 @@ function normalizeOrderProduct(product) {
|
|
|
316
351
|
metadata.main_product_selling_price = resolvedSellingPrice;
|
|
317
352
|
}
|
|
318
353
|
if (metadata.source_product_price === void 0) {
|
|
319
|
-
metadata.source_product_price = ((_a = product._origin) == null ? void 0 : _a.
|
|
354
|
+
metadata.source_product_price = ((_a = product._origin) == null ? void 0 : _a.price) ?? ((_b = product._origin) == null ? void 0 : _b.base_price) ?? resolvedSellingPrice;
|
|
320
355
|
}
|
|
321
356
|
const normalizedBundle = (product.product_bundle || []).map((item) => ({
|
|
322
357
|
...item,
|
|
@@ -332,7 +367,6 @@ function normalizeOrderProduct(product) {
|
|
|
332
367
|
product_option_item: product.product_option_item || [],
|
|
333
368
|
selling_price: resolvedSellingPrice,
|
|
334
369
|
original_price: resolvedOriginalPrice,
|
|
335
|
-
payment_price: product.payment_price || "0.00",
|
|
336
370
|
tax_fee: product.tax_fee || "0.00",
|
|
337
371
|
is_charge_tax: product.is_charge_tax ?? 0,
|
|
338
372
|
discount_list: product.discount_list || [],
|
|
@@ -377,6 +411,33 @@ function hasCustomCapacityProduct(products) {
|
|
|
377
411
|
return ((_a = p == null ? void 0 : p.capacity) == null ? void 0 : _a.type) === "custom";
|
|
378
412
|
});
|
|
379
413
|
}
|
|
414
|
+
function pickFirstCustomCapacityPaxBounds(products) {
|
|
415
|
+
for (const p of products) {
|
|
416
|
+
const cap = p == null ? void 0 : p.capacity;
|
|
417
|
+
if (!cap || cap.type !== "custom")
|
|
418
|
+
continue;
|
|
419
|
+
if (!Array.isArray(cap.custom) || cap.custom.length === 0)
|
|
420
|
+
continue;
|
|
421
|
+
const row = cap.custom[0];
|
|
422
|
+
if (!row || typeof row !== "object")
|
|
423
|
+
continue;
|
|
424
|
+
const raw = row;
|
|
425
|
+
const out = {};
|
|
426
|
+
if (raw.min !== null && raw.min !== void 0 && raw.min !== "") {
|
|
427
|
+
const min = Number(raw.min);
|
|
428
|
+
if (Number.isFinite(min))
|
|
429
|
+
out.min = min;
|
|
430
|
+
}
|
|
431
|
+
if (raw.max !== null && raw.max !== void 0 && raw.max !== "") {
|
|
432
|
+
const max = Number(raw.max);
|
|
433
|
+
if (Number.isFinite(max))
|
|
434
|
+
out.max = max;
|
|
435
|
+
}
|
|
436
|
+
if (out.min !== void 0 || out.max !== void 0)
|
|
437
|
+
return out;
|
|
438
|
+
}
|
|
439
|
+
return void 0;
|
|
440
|
+
}
|
|
380
441
|
// Annotate the CommonJS export names for ESM import in node:
|
|
381
442
|
0 && (module.exports = {
|
|
382
443
|
aggregateItemRuleLimit,
|
|
@@ -396,6 +457,7 @@ function hasCustomCapacityProduct(products) {
|
|
|
396
457
|
normalizeEnabledItemRuleIds,
|
|
397
458
|
normalizeItemRuleStrategies,
|
|
398
459
|
normalizeOrderProduct,
|
|
460
|
+
pickFirstCustomCapacityPaxBounds,
|
|
399
461
|
pickFirstDurationMinutesFromProducts,
|
|
400
462
|
resolveSkuMatchedQuantityLimits,
|
|
401
463
|
toBoolean,
|
|
@@ -876,7 +876,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
876
876
|
num: 1,
|
|
877
877
|
selling_price: group.totalPrice,
|
|
878
878
|
original_price: group.totalPrice,
|
|
879
|
-
payment_price: group.totalPrice,
|
|
880
879
|
is_charge_tax: (venueProduct == null ? void 0 : venueProduct.is_charge_tax) ?? 0,
|
|
881
880
|
metadata: {
|
|
882
881
|
venue_booking: true,
|
|
@@ -1052,7 +1051,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1052
1051
|
const merged = (0, import_slotMerge.mergeConsecutiveSlots)(updatedSlots);
|
|
1053
1052
|
if (merged.length === 1) {
|
|
1054
1053
|
product.selling_price = merged[0].totalPrice;
|
|
1055
|
-
product.
|
|
1054
|
+
product.original_price = merged[0].totalPrice;
|
|
1056
1055
|
product.metadata.price_breakdown = (0, import_slotMerge.buildPriceBreakdown)({
|
|
1057
1056
|
group: merged[0],
|
|
1058
1057
|
productId: mapping.productId,
|
|
@@ -1067,7 +1066,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1067
1066
|
});
|
|
1068
1067
|
if (quotationPrice !== null) {
|
|
1069
1068
|
product.selling_price = quotationPrice;
|
|
1070
|
-
product.
|
|
1069
|
+
product.original_price = quotationPrice;
|
|
1071
1070
|
}
|
|
1072
1071
|
}
|
|
1073
1072
|
}
|
|
@@ -1162,15 +1161,14 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1162
1161
|
return rid != null && selectedResourceIds.has(rid);
|
|
1163
1162
|
});
|
|
1164
1163
|
if (product.discount_list.length < before) {
|
|
1165
|
-
const
|
|
1164
|
+
const totalPerUnitDiscount = product.discount_list.reduce(
|
|
1166
1165
|
(sum, pd) => sum + (pd.amount || 0),
|
|
1167
1166
|
0
|
|
1168
1167
|
);
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
product.payment_price = paymentStr;
|
|
1168
|
+
const newSellingPrice = new import_decimal.default(product.original_price || product.selling_price || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1169
|
+
product.selling_price = newSellingPrice;
|
|
1172
1170
|
if (product.metadata) {
|
|
1173
|
-
product.metadata.main_product_selling_price =
|
|
1171
|
+
product.metadata.main_product_selling_price = newSellingPrice;
|
|
1174
1172
|
}
|
|
1175
1173
|
}
|
|
1176
1174
|
}
|
|
@@ -1267,10 +1265,9 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1267
1265
|
});
|
|
1268
1266
|
if (quotationPrice !== null) {
|
|
1269
1267
|
product.selling_price = quotationPrice;
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
product.payment_price = quotationPrice;
|
|
1268
|
+
product.original_price = quotationPrice;
|
|
1269
|
+
} else if (product.selling_price != null) {
|
|
1270
|
+
product.original_price = product.selling_price;
|
|
1274
1271
|
}
|
|
1275
1272
|
}
|
|
1276
1273
|
const products = await this.store.order.addProductToOrder(product);
|
|
@@ -1515,16 +1512,13 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1515
1512
|
});
|
|
1516
1513
|
if (productIndex === -1) {
|
|
1517
1514
|
const sellingPrice = (0, import_utils.toPriceString)((sourceItem == null ? void 0 : sourceItem.price) ?? (sourceItem == null ? void 0 : sourceItem.selling_price), "0.00");
|
|
1518
|
-
const originalPrice = (0, import_utils.toPriceString)((sourceItem == null ? void 0 : sourceItem.original_price) ?? (sourceItem == null ? void 0 : sourceItem.price) ?? sellingPrice, sellingPrice);
|
|
1519
|
-
const paymentPrice = (0, import_utils.toPriceString)((sourceItem == null ? void 0 : sourceItem.payment_price) ?? (sourceItem == null ? void 0 : sourceItem.price) ?? sellingPrice, sellingPrice);
|
|
1520
1515
|
tempOrder.products.push(
|
|
1521
1516
|
(0, import_utils.normalizeOrderProduct)({
|
|
1522
1517
|
product_id: productId,
|
|
1523
1518
|
product_variant_id: productVariantId,
|
|
1524
1519
|
num: targetQuantity,
|
|
1525
1520
|
selling_price: sellingPrice,
|
|
1526
|
-
original_price:
|
|
1527
|
-
payment_price: paymentPrice,
|
|
1521
|
+
original_price: sellingPrice,
|
|
1528
1522
|
metadata: { item_rule_prefill: true, item_rule_id: prefillItem.ruleId },
|
|
1529
1523
|
_origin: { ...sourceItem || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId }
|
|
1530
1524
|
})
|
|
@@ -1547,6 +1541,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1547
1541
|
}
|
|
1548
1542
|
}
|
|
1549
1543
|
if (hasChanges) {
|
|
1544
|
+
this.store.order.applyDiscount();
|
|
1550
1545
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
1551
1546
|
this.store.order.persistTempOrder();
|
|
1552
1547
|
}
|