@pisell/pisellos 2.2.246 → 2.2.248
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/modules/Order/index.d.ts +5 -0
- package/dist/modules/Order/index.js +250 -138
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Payment/walletpass.js +1 -1
- package/dist/server/utils/small-ticket.d.ts +1 -0
- package/dist/server/utils/small-ticket.js +179 -53
- package/dist/solution/BaseSales/index.js +11 -6
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.d.ts +5 -0
- package/lib/modules/Order/index.js +125 -15
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Payment/walletpass.js +1 -1
- package/lib/server/utils/small-ticket.d.ts +1 -0
- package/lib/server/utils/small-ticket.js +119 -12
- package/lib/solution/BaseSales/index.js +21 -6
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -283,7 +283,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
283
283
|
filter_prepare_wallet_pass: 1
|
|
284
284
|
}); // 并行获取用户识别码列表和订单详情
|
|
285
285
|
_context3.next = 4;
|
|
286
|
-
return Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
|
|
286
|
+
return Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id && typeof baseParams.payment_order_id === 'string' && !baseParams.payment_order_id.startsWith('LOCAL_') ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
|
|
287
287
|
case 4:
|
|
288
288
|
_yield$Promise$all = _context3.sent;
|
|
289
289
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
4
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
6
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3
8
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -38,8 +38,11 @@ var LABELS = {
|
|
|
38
38
|
remainingPoints: 'Remaining points',
|
|
39
39
|
table: 'Table',
|
|
40
40
|
orderDiscount: 'Order discount',
|
|
41
|
+
manualDiscount: 'Manual discount',
|
|
41
42
|
payProcessingFee: 'Pay processing fee',
|
|
42
|
-
rounding: 'Rounding'
|
|
43
|
+
rounding: 'Rounding',
|
|
44
|
+
gross: 'Gross',
|
|
45
|
+
tare: 'Tare'
|
|
43
46
|
},
|
|
44
47
|
zh_CN: {
|
|
45
48
|
contactName: '联系人姓名',
|
|
@@ -61,8 +64,11 @@ var LABELS = {
|
|
|
61
64
|
remainingPoints: '剩余积分',
|
|
62
65
|
table: '桌台',
|
|
63
66
|
orderDiscount: '整单折扣',
|
|
67
|
+
manualDiscount: '手动折扣',
|
|
64
68
|
payProcessingFee: '支付手续费',
|
|
65
|
-
rounding: '抹零'
|
|
69
|
+
rounding: '抹零',
|
|
70
|
+
gross: '重量',
|
|
71
|
+
tare: '去皮'
|
|
66
72
|
},
|
|
67
73
|
zh_HK: {
|
|
68
74
|
contactName: '聯絡人姓名',
|
|
@@ -84,8 +90,11 @@ var LABELS = {
|
|
|
84
90
|
remainingPoints: '剩餘積分',
|
|
85
91
|
table: '桌台',
|
|
86
92
|
orderDiscount: '整單折扣',
|
|
93
|
+
manualDiscount: '手動折扣',
|
|
87
94
|
payProcessingFee: '支付手續費',
|
|
88
|
-
rounding: '抹零'
|
|
95
|
+
rounding: '抹零',
|
|
96
|
+
gross: '重量',
|
|
97
|
+
tare: '去皮'
|
|
89
98
|
}
|
|
90
99
|
};
|
|
91
100
|
export function buildSmallTicketData(params) {
|
|
@@ -197,14 +206,29 @@ function buildProducts(order, locale, productMap) {
|
|
|
197
206
|
parentProduct: parentProduct,
|
|
198
207
|
locale: locale
|
|
199
208
|
});
|
|
200
|
-
|
|
209
|
+
var extensionList = buildProductExtensionList({
|
|
210
|
+
product: product,
|
|
211
|
+
locale: locale,
|
|
212
|
+
currencySymbol: currencySymbol,
|
|
213
|
+
quantity: quantity,
|
|
214
|
+
originalPrice: originalPrice
|
|
215
|
+
});
|
|
216
|
+
var discountList = normalizeProductDiscounts({
|
|
217
|
+
product: product,
|
|
218
|
+
locale: locale,
|
|
219
|
+
currencySymbol: currencySymbol,
|
|
220
|
+
quantity: quantity
|
|
221
|
+
});
|
|
222
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
201
223
|
product_title: productTitle,
|
|
202
224
|
product_quantity: quantity,
|
|
203
225
|
selling_price: formatMoney(sellingPrice, currencySymbol),
|
|
204
226
|
original_price: formatMoney(originalPrice, currencySymbol),
|
|
205
227
|
total_original_price: formatMoney(new Decimal(toMoneyNumber(originalPrice)).mul(quantity), currencySymbol),
|
|
206
|
-
extension_list:
|
|
207
|
-
},
|
|
228
|
+
extension_list: extensionList
|
|
229
|
+
}, discountList.length ? {
|
|
230
|
+
discount_list: discountList
|
|
231
|
+
} : {}), options.length ? {
|
|
208
232
|
options: options
|
|
209
233
|
} : {}), resolvedVariant ? {
|
|
210
234
|
variant: resolvedVariant
|
|
@@ -215,6 +239,99 @@ function buildProducts(order, locale, productMap) {
|
|
|
215
239
|
} : {});
|
|
216
240
|
});
|
|
217
241
|
}
|
|
242
|
+
function normalizeProductDiscounts(params) {
|
|
243
|
+
var product = params.product,
|
|
244
|
+
locale = params.locale,
|
|
245
|
+
currencySymbol = params.currencySymbol,
|
|
246
|
+
quantity = params.quantity;
|
|
247
|
+
return normalizeArray(product.discount_list).map(function (discount) {
|
|
248
|
+
var _ref8, _discount$amount;
|
|
249
|
+
var title = resolveDiscountTitleWithPercent(discount, locale);
|
|
250
|
+
var amount = (_ref8 = (_discount$amount = discount.amount) !== null && _discount$amount !== void 0 ? _discount$amount : discount.value) !== null && _ref8 !== void 0 ? _ref8 : discount.discount_amount;
|
|
251
|
+
var formattedAmount = formatNegativeMoney(new Decimal(toMoneyNumber(amount)).mul(quantity), currencySymbol);
|
|
252
|
+
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
253
|
+
item: title,
|
|
254
|
+
name: title,
|
|
255
|
+
title: title,
|
|
256
|
+
value: formattedAmount
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function buildProductExtensionList(params) {
|
|
261
|
+
var product = params.product,
|
|
262
|
+
locale = params.locale,
|
|
263
|
+
currencySymbol = params.currencySymbol,
|
|
264
|
+
quantity = params.quantity,
|
|
265
|
+
originalPrice = params.originalPrice;
|
|
266
|
+
var extensionList = [].concat(_toConsumableArray(buildProductOpenWeightRows({
|
|
267
|
+
product: product,
|
|
268
|
+
locale: locale,
|
|
269
|
+
currencySymbol: currencySymbol
|
|
270
|
+
})), _toConsumableArray(quantity > 1 ? [{
|
|
271
|
+
item: buildProductQuantityPriceText({
|
|
272
|
+
quantity: quantity,
|
|
273
|
+
currencySymbol: currencySymbol,
|
|
274
|
+
price: originalPrice
|
|
275
|
+
}),
|
|
276
|
+
value: ''
|
|
277
|
+
}] : []));
|
|
278
|
+
return extensionList.length ? extensionList : normalizeArray(product.extension_list);
|
|
279
|
+
}
|
|
280
|
+
function buildProductOpenWeightRows(params) {
|
|
281
|
+
var _productSku$unit, _productSku$net_weigh, _productSku$unit_pric;
|
|
282
|
+
var product = params.product,
|
|
283
|
+
locale = params.locale,
|
|
284
|
+
currencySymbol = params.currencySymbol;
|
|
285
|
+
var productSku = product.product_sku || {};
|
|
286
|
+
if (productSku.open_sold_weight != 1) return [];
|
|
287
|
+
var unit = (_productSku$unit = productSku.unit) !== null && _productSku$unit !== void 0 ? _productSku$unit : '';
|
|
288
|
+
var manualFlag = productSku.weight_source === 'manual' ? '(M) ' : '';
|
|
289
|
+
var hasTare = toNumber(productSku.tare_weight, 0) > 0;
|
|
290
|
+
var rows = [];
|
|
291
|
+
if (hasTare) {
|
|
292
|
+
var _productSku$weight;
|
|
293
|
+
rows.push({
|
|
294
|
+
item: "".concat(manualFlag).concat(label(locale, 'gross'), ": ").concat((_productSku$weight = productSku.weight) !== null && _productSku$weight !== void 0 ? _productSku$weight : 0).concat(unit),
|
|
295
|
+
value: ''
|
|
296
|
+
});
|
|
297
|
+
rows.push({
|
|
298
|
+
item: "".concat(label(locale, 'tare'), ": ").concat(productSku.tare_weight).concat(unit),
|
|
299
|
+
value: ''
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
var netWeight = (_productSku$net_weigh = productSku.net_weight) !== null && _productSku$net_weigh !== void 0 ? _productSku$net_weigh : 0;
|
|
303
|
+
var unitPrice = (_productSku$unit_pric = productSku.unit_price) !== null && _productSku$unit_pric !== void 0 ? _productSku$unit_pric : 0;
|
|
304
|
+
var netItem = "".concat(netWeight, " ").concat(unit, " NET @ ").concat(currencySymbol).concat(unitPrice, "/").concat(unit);
|
|
305
|
+
rows.push({
|
|
306
|
+
item: hasTare ? netItem : "".concat(manualFlag).concat(netItem),
|
|
307
|
+
value: ''
|
|
308
|
+
});
|
|
309
|
+
return rows;
|
|
310
|
+
}
|
|
311
|
+
function buildProductQuantityPriceText(params) {
|
|
312
|
+
var quantity = params.quantity,
|
|
313
|
+
currencySymbol = params.currencySymbol,
|
|
314
|
+
price = params.price;
|
|
315
|
+
return "".concat(quantity, " @ ").concat(currencySymbol).concat(stringify(price), " EACH");
|
|
316
|
+
}
|
|
317
|
+
function resolveDiscountTitleWithPercent(discount, locale) {
|
|
318
|
+
var _discount$discount, _discount$discount$di, _discount$discount2;
|
|
319
|
+
var title = resolveDiscountTitle(discount, locale);
|
|
320
|
+
var percentRaw = (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.percent;
|
|
321
|
+
var cardType = (_discount$discount$di = (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.discount_card_type) !== null && _discount$discount$di !== void 0 ? _discount$discount$di : 'percent';
|
|
322
|
+
var percent = percentRaw !== undefined && percentRaw !== null ? Math.trunc(Number(percentRaw)) : NaN;
|
|
323
|
+
if (percentRaw === undefined || percentRaw === null) return title;
|
|
324
|
+
if (cardType !== 'percent') return title;
|
|
325
|
+
if (Number.isNaN(percent)) return title;
|
|
326
|
+
return "".concat(title, " (").concat(percent, "%)");
|
|
327
|
+
}
|
|
328
|
+
function resolveDiscountTitle(discount, locale) {
|
|
329
|
+
var _ref9, _ref10, _ref11, _ref12, _discount$discount$na, _discount$discount3, _discount$discount4, _discount$discount5;
|
|
330
|
+
var title = getLocalizedValue((_ref9 = (_ref10 = (_ref11 = (_ref12 = (_discount$discount$na = (_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.name) !== null && _discount$discount$na !== void 0 ? _discount$discount$na : (_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.title) !== null && _ref12 !== void 0 ? _ref12 : (_discount$discount5 = discount.discount) === null || _discount$discount5 === void 0 ? void 0 : _discount$discount5.message) !== null && _ref11 !== void 0 ? _ref11 : discount.name) !== null && _ref10 !== void 0 ? _ref10 : discount.title) !== null && _ref9 !== void 0 ? _ref9 : discount.message, locale);
|
|
331
|
+
if (title) return title;
|
|
332
|
+
if (discount.type === 'product') return label(locale, 'manualDiscount');
|
|
333
|
+
return '';
|
|
334
|
+
}
|
|
218
335
|
function resolveProductTitle(params) {
|
|
219
336
|
var _product$product_id2;
|
|
220
337
|
var product = params.product,
|
|
@@ -235,9 +352,9 @@ function normalizeProductOptions(params) {
|
|
|
235
352
|
parentProduct = params.parentProduct;
|
|
236
353
|
var rawOptions = Array.isArray(params.options) ? params.options : Array.isArray(product.options) ? product.options : Array.isArray((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) ? product.product_sku.option : [];
|
|
237
354
|
return rawOptions.map(function (option) {
|
|
238
|
-
var
|
|
239
|
-
var price = (
|
|
240
|
-
var value = (
|
|
355
|
+
var _ref13, _option$original_pric, _ref14, _option$value, _option$num;
|
|
356
|
+
var price = (_ref13 = (_option$original_pric = option.original_price) !== null && _option$original_pric !== void 0 ? _option$original_pric : option.add_price) !== null && _ref13 !== void 0 ? _ref13 : option.price;
|
|
357
|
+
var value = (_ref14 = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.option) !== null && _ref14 !== void 0 ? _ref14 : option.item;
|
|
241
358
|
var name = getProductTitleSource(option, locale) || resolveOptionTitleFromParentProduct({
|
|
242
359
|
option: option,
|
|
243
360
|
parentProduct: parentProduct,
|
|
@@ -262,7 +379,7 @@ function normalizeProductCombinations(params) {
|
|
|
262
379
|
parentProduct = params.parentProduct;
|
|
263
380
|
var bundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
|
|
264
381
|
return bundles.map(function (bundle) {
|
|
265
|
-
var
|
|
382
|
+
var _ref15, _bundle$num;
|
|
266
383
|
var combinationsOptions = normalizeProductOptions({
|
|
267
384
|
product: {},
|
|
268
385
|
locale: locale,
|
|
@@ -279,14 +396,14 @@ function normalizeProductCombinations(params) {
|
|
|
279
396
|
var optionTitle = buildOptionTitleSuffix(combinationsOptions);
|
|
280
397
|
return {
|
|
281
398
|
product_title: "".concat(baseTitle).concat(optionTitle),
|
|
282
|
-
product_quantity: toNumber((
|
|
399
|
+
product_quantity: toNumber((_ref15 = (_bundle$num = bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle.quantity) !== null && _ref15 !== void 0 ? _ref15 : 1, 1),
|
|
283
400
|
price: formatBundlePrice(bundle, currencySymbol),
|
|
284
401
|
combinations_options: combinationsOptions
|
|
285
402
|
};
|
|
286
403
|
});
|
|
287
404
|
}
|
|
288
405
|
function resolveBundleProductTitle(params) {
|
|
289
|
-
var
|
|
406
|
+
var _ref16, _ref17, _bundle$bundle_produc;
|
|
290
407
|
var bundle = params.bundle,
|
|
291
408
|
productMap = params.productMap,
|
|
292
409
|
locale = params.locale,
|
|
@@ -299,7 +416,7 @@ function resolveBundleProductTitle(params) {
|
|
|
299
416
|
});
|
|
300
417
|
var parentBundleTitle = parentBundleItem ? getProductTitleSource(parentBundleItem, locale) : '';
|
|
301
418
|
if (parentBundleTitle) return parentBundleTitle;
|
|
302
|
-
var productId = (
|
|
419
|
+
var productId = (_ref16 = (_ref17 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref17 !== void 0 ? _ref17 : bundle.product_id) !== null && _ref16 !== void 0 ? _ref16 : bundle.id;
|
|
303
420
|
var fallbackProduct = resolveProductFromMap(productId, productMap);
|
|
304
421
|
if (!fallbackProduct) return '';
|
|
305
422
|
return getProductTitleSource(fallbackProduct, locale);
|
|
@@ -351,10 +468,10 @@ function resolveVariantTextFromSkuKey(params) {
|
|
|
351
468
|
}
|
|
352
469
|
function resolveVariantTextFromNameMap(params) {
|
|
353
470
|
if (!params.nameMap || _typeof(params.nameMap) !== 'object') return '';
|
|
354
|
-
return Object.entries(params.nameMap).map(function (
|
|
355
|
-
var
|
|
356
|
-
groupPositionId =
|
|
357
|
-
value =
|
|
471
|
+
return Object.entries(params.nameMap).map(function (_ref18) {
|
|
472
|
+
var _ref19 = _slicedToArray(_ref18, 2),
|
|
473
|
+
groupPositionId = _ref19[0],
|
|
474
|
+
value = _ref19[1];
|
|
358
475
|
var group = resolveVariantGroup(params.parentProduct, groupPositionId);
|
|
359
476
|
if (!group) return '';
|
|
360
477
|
var groupName = getLocalizedValue(group.name, params.locale);
|
|
@@ -388,12 +505,12 @@ function getProductTitleSource(source, locale) {
|
|
|
388
505
|
return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
|
|
389
506
|
}
|
|
390
507
|
function resolveTitleValue(value, locale) {
|
|
391
|
-
var
|
|
508
|
+
var _ref20, _ref21, _ref22, _ref23, _value$locale;
|
|
392
509
|
if (value === undefined || value === null) return '';
|
|
393
510
|
if (_typeof(value) !== 'object') return stringify(value);
|
|
394
511
|
var dashedLocale = locale.replace('_', '-');
|
|
395
512
|
var underscoredLocale = locale.replace('-', '_');
|
|
396
|
-
return stringify((
|
|
513
|
+
return stringify((_ref20 = (_ref21 = (_ref22 = (_ref23 = (_value$locale = value[locale]) !== null && _value$locale !== void 0 ? _value$locale : value[dashedLocale]) !== null && _ref23 !== void 0 ? _ref23 : value[underscoredLocale]) !== null && _ref22 !== void 0 ? _ref22 : value.original) !== null && _ref21 !== void 0 ? _ref21 : value.auto) !== null && _ref20 !== void 0 ? _ref20 : '');
|
|
397
514
|
}
|
|
398
515
|
function resolveOptionTitleFromParentProduct(params) {
|
|
399
516
|
var option = params.option,
|
|
@@ -411,17 +528,17 @@ function flattenOptionItems(parentProduct) {
|
|
|
411
528
|
return optionGroups.flatMap(function (group) {
|
|
412
529
|
var items = normalizeArray(group.option_item || group.option_items || group.option || group.options || group.items || group.children || group.product_option_item);
|
|
413
530
|
return items.map(function (item) {
|
|
414
|
-
var
|
|
531
|
+
var _ref24, _item$option_group_id;
|
|
415
532
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
416
|
-
option_group_id: (
|
|
533
|
+
option_group_id: (_ref24 = (_item$option_group_id = item.option_group_id) !== null && _item$option_group_id !== void 0 ? _item$option_group_id : group.id) !== null && _ref24 !== void 0 ? _ref24 : group.option_group_id
|
|
417
534
|
});
|
|
418
535
|
});
|
|
419
536
|
});
|
|
420
537
|
}
|
|
421
538
|
function isOptionItemMatch(option, item) {
|
|
422
|
-
var
|
|
423
|
-
var optionItemId = (
|
|
424
|
-
var itemId = (
|
|
539
|
+
var _ref25, _option$option_group_, _ref26, _item$option_group_it, _option$option_group_2, _item$option_group_id2;
|
|
540
|
+
var optionItemId = (_ref25 = (_option$option_group_ = option.option_group_item_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : option.product_option_item_id) !== null && _ref25 !== void 0 ? _ref25 : option.id;
|
|
541
|
+
var itemId = (_ref26 = (_item$option_group_it = item.option_group_item_id) !== null && _item$option_group_it !== void 0 ? _item$option_group_it : item.product_option_item_id) !== null && _ref26 !== void 0 ? _ref26 : item.id;
|
|
425
542
|
if (!isSameId(optionItemId, itemId)) return false;
|
|
426
543
|
var optionGroupId = (_option$option_group_2 = option.option_group_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option.group_id;
|
|
427
544
|
var itemGroupId = (_item$option_group_id2 = item.option_group_id) !== null && _item$option_group_id2 !== void 0 ? _item$option_group_id2 : item.group_id;
|
|
@@ -431,16 +548,16 @@ function isOptionItemMatch(option, item) {
|
|
|
431
548
|
return true;
|
|
432
549
|
}
|
|
433
550
|
function resolveBundleItemFromParentProduct(params) {
|
|
434
|
-
var
|
|
551
|
+
var _ref27, _bundle$bundle_varian, _bundle$bundle_id, _bundle$bundle_group_, _ref29, _bundle$bundle_produc2;
|
|
435
552
|
var bundle = params.bundle,
|
|
436
553
|
parentProduct = params.parentProduct;
|
|
437
554
|
if (!parentProduct) return null;
|
|
438
555
|
var bundleItems = flattenBundleItems(parentProduct);
|
|
439
|
-
var bundleVariantId = (
|
|
556
|
+
var bundleVariantId = (_ref27 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref27 !== void 0 ? _ref27 : bundle.product_variant_id;
|
|
440
557
|
if (isNonZeroId(bundleVariantId)) {
|
|
441
558
|
var matchedByVariant = bundleItems.find(function (item) {
|
|
442
|
-
var
|
|
443
|
-
return isSameId((
|
|
559
|
+
var _ref28, _item$bundle_variant_;
|
|
560
|
+
return isSameId((_ref28 = (_item$bundle_variant_ = item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item.variant_id) !== null && _ref28 !== void 0 ? _ref28 : item.product_variant_id, bundleVariantId);
|
|
444
561
|
});
|
|
445
562
|
if (matchedByVariant) return matchedByVariant;
|
|
446
563
|
}
|
|
@@ -453,18 +570,18 @@ function resolveBundleItemFromParentProduct(params) {
|
|
|
453
570
|
if (matchedByBundleId) return matchedByBundleId;
|
|
454
571
|
}
|
|
455
572
|
var bundleGroupId = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id;
|
|
456
|
-
var bundleProductId = (
|
|
573
|
+
var bundleProductId = (_ref29 = (_bundle$bundle_produc2 = bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle._bundle_product_id) !== null && _ref29 !== void 0 ? _ref29 : bundle.product_id;
|
|
457
574
|
if (isPresentId(bundleGroupId) && isPresentId(bundleProductId)) {
|
|
458
575
|
var matchedByGroupAndProduct = bundleItems.find(function (item) {
|
|
459
|
-
var _item$group_id,
|
|
460
|
-
return isSameId((_item$group_id = item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : item.bundle_group_id, bundleGroupId) && isSameId((
|
|
576
|
+
var _item$group_id, _ref30, _item$bundle_product_;
|
|
577
|
+
return isSameId((_item$group_id = item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : item.bundle_group_id, bundleGroupId) && isSameId((_ref30 = (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id) !== null && _ref30 !== void 0 ? _ref30 : item.product_id, bundleProductId);
|
|
461
578
|
});
|
|
462
579
|
if (matchedByGroupAndProduct) return matchedByGroupAndProduct;
|
|
463
580
|
}
|
|
464
581
|
if (isPresentId(bundleProductId)) {
|
|
465
582
|
return bundleItems.find(function (item) {
|
|
466
|
-
var
|
|
467
|
-
return isSameId((
|
|
583
|
+
var _ref31, _item$bundle_product_2;
|
|
584
|
+
return isSameId((_ref31 = (_item$bundle_product_2 = item.bundle_product_id) !== null && _item$bundle_product_2 !== void 0 ? _item$bundle_product_2 : item._bundle_product_id) !== null && _ref31 !== void 0 ? _ref31 : item.product_id, bundleProductId);
|
|
468
585
|
}) || null;
|
|
469
586
|
}
|
|
470
587
|
return null;
|
|
@@ -474,9 +591,9 @@ function flattenBundleItems(parentProduct) {
|
|
|
474
591
|
return bundleGroups.flatMap(function (group) {
|
|
475
592
|
var items = Array.isArray(group.bundle_item) ? group.bundle_item : [];
|
|
476
593
|
return items.map(function (item) {
|
|
477
|
-
var
|
|
594
|
+
var _ref32, _item$group_id2;
|
|
478
595
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
479
|
-
group_id: (
|
|
596
|
+
group_id: (_ref32 = (_item$group_id2 = item.group_id) !== null && _item$group_id2 !== void 0 ? _item$group_id2 : group.id) !== null && _ref32 !== void 0 ? _ref32 : group.group_id
|
|
480
597
|
});
|
|
481
598
|
});
|
|
482
599
|
});
|
|
@@ -502,14 +619,15 @@ function buildOptionTitleSuffix(options) {
|
|
|
502
619
|
return text ? "(".concat(text, ")") : '';
|
|
503
620
|
}
|
|
504
621
|
function formatBundlePrice(bundle, currencySymbol) {
|
|
505
|
-
var
|
|
506
|
-
var value = (
|
|
622
|
+
var _ref33, _ref34, _bundle$bundle_sellin;
|
|
623
|
+
var value = (_ref33 = (_ref34 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.bundle_sum_price) !== null && _ref34 !== void 0 ? _ref34 : bundle.price) !== null && _ref33 !== void 0 ? _ref33 : 0;
|
|
507
624
|
var amount = new Decimal(toMoneyNumber(value));
|
|
508
625
|
var isNegative = bundle.price_type === 'markdown' || bundle.price_type === 'markup' && bundle.price_type_ext === 'product_price';
|
|
509
626
|
if (isNegative) return "-".concat(currencySymbol).concat(amount.abs().toFixed(2));
|
|
510
627
|
return formatMoney(amount, currencySymbol);
|
|
511
628
|
}
|
|
512
629
|
function buildFees(params) {
|
|
630
|
+
var _ref36, _order$shop_discount, _ref37, _summary$product_orig;
|
|
513
631
|
var order = params.order,
|
|
514
632
|
shopInfo = params.shopInfo,
|
|
515
633
|
locale = params.locale,
|
|
@@ -518,20 +636,20 @@ function buildFees(params) {
|
|
|
518
636
|
currencySymbol = params.currencySymbol;
|
|
519
637
|
var fees = [];
|
|
520
638
|
for (var _i = 0, _normalizeArray = normalizeArray(order.surcharges || summary.surcharges); _i < _normalizeArray.length; _i++) {
|
|
521
|
-
var
|
|
639
|
+
var _ref35, _surcharge$amount;
|
|
522
640
|
var surcharge = _normalizeArray[_i];
|
|
523
|
-
var value = (
|
|
641
|
+
var value = (_ref35 = (_surcharge$amount = surcharge.amount) !== null && _surcharge$amount !== void 0 ? _surcharge$amount : surcharge.value) !== null && _ref35 !== void 0 ? _ref35 : surcharge.total_amount;
|
|
524
642
|
if (!isNonZero(value)) continue;
|
|
525
643
|
fees.push({
|
|
526
644
|
item: getLocalizedValue(surcharge.name || surcharge.title || surcharge.item, locale),
|
|
527
645
|
value: formatMoney(value, currencySymbol)
|
|
528
646
|
});
|
|
529
647
|
}
|
|
530
|
-
var discountAmount =
|
|
648
|
+
var discountAmount = (_ref36 = (_order$shop_discount = order.shop_discount) !== null && _order$shop_discount !== void 0 ? _order$shop_discount : summary.discount_amount) !== null && _ref36 !== void 0 ? _ref36 : order.discount_amount;
|
|
531
649
|
if (isNonZero(discountAmount)) {
|
|
532
650
|
fees.push({
|
|
533
651
|
item: label(locale, 'orderDiscount'),
|
|
534
|
-
value:
|
|
652
|
+
value: formatNegativeMoney(discountAmount, currencySymbol)
|
|
535
653
|
});
|
|
536
654
|
}
|
|
537
655
|
var taxFee = summary.tax_fee || order.tax_fee;
|
|
@@ -555,11 +673,14 @@ function buildFees(params) {
|
|
|
555
673
|
value: formatMoney(payProcessingFee, currencySymbol)
|
|
556
674
|
});
|
|
557
675
|
}
|
|
676
|
+
var productExpectAmount = summary.product_expect_amount || summary.product_amount || order.product_expect_amount;
|
|
677
|
+
var productOriginalAmount = (_ref37 = (_summary$product_orig = summary.product_original_amount) !== null && _summary$product_orig !== void 0 ? _summary$product_orig : order.product_original_amount) !== null && _ref37 !== void 0 ? _ref37 : productExpectAmount;
|
|
678
|
+
var totalSavingsAmount = new Decimal(toMoneyNumber(productOriginalAmount)).minus(toMoneyNumber(productExpectAmount)).plus(toMoneyNumber(discountAmount));
|
|
558
679
|
return {
|
|
559
680
|
fees: fees,
|
|
560
681
|
countFee: _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
561
682
|
total_amount: formatMoney(summary.total_amount || order.total_amount, currencySymbol),
|
|
562
|
-
product_expect_amount: formatMoney(
|
|
683
|
+
product_expect_amount: formatMoney(productExpectAmount, currencySymbol),
|
|
563
684
|
expect_amount: formatMoney(summary.expect_amount || order.expect_amount || summary.total_amount || order.total_amount, currencySymbol),
|
|
564
685
|
product_quantity: toNumber(summary.product_quantity || products.reduce(function (sum, product) {
|
|
565
686
|
return sum + product.product_quantity;
|
|
@@ -570,8 +691,8 @@ function buildFees(params) {
|
|
|
570
691
|
total_refund_amount: formatMoney(summary.total_refund_amount || order.total_refund_amount, currencySymbol)
|
|
571
692
|
}, isNonZero(roundingAmount) ? {
|
|
572
693
|
rounding_amount: formatMoney(roundingAmount, currencySymbol)
|
|
573
|
-
} : {}), isNonZero(
|
|
574
|
-
order_total_discount: formatMoney(
|
|
694
|
+
} : {}), isNonZero(totalSavingsAmount) ? {
|
|
695
|
+
order_total_discount: formatMoney(totalSavingsAmount, currencySymbol)
|
|
575
696
|
} : {}), isNonZero(payProcessingFee) ? {
|
|
576
697
|
pay_processing_fee: formatMoney(payProcessingFee, currencySymbol)
|
|
577
698
|
} : {}), isNonZero(taxFee) ? {
|
|
@@ -655,8 +776,8 @@ function buildPaymentData(params) {
|
|
|
655
776
|
currencySymbol: params.currencySymbol
|
|
656
777
|
})));
|
|
657
778
|
} else {
|
|
658
|
-
var
|
|
659
|
-
var remainingAmount = (
|
|
779
|
+
var _ref38, _payment$remaining_am, _payment$metadata;
|
|
780
|
+
var remainingAmount = (_ref38 = (_payment$remaining_am = payment.remaining_amount) !== null && _payment$remaining_am !== void 0 ? _payment$remaining_am : payment.balance) !== null && _ref38 !== void 0 ? _ref38 : (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.remaining_amount;
|
|
660
781
|
if (remainingAmount !== undefined && remainingAmount !== null) {
|
|
661
782
|
items.push({
|
|
662
783
|
item: label(params.locale, 'remainingAmount'),
|
|
@@ -764,11 +885,12 @@ function label(locale, key) {
|
|
|
764
885
|
return ((_LABELS$locale = LABELS[locale]) === null || _LABELS$locale === void 0 ? void 0 : _LABELS$locale[key]) || LABELS.en[key] || key;
|
|
765
886
|
}
|
|
766
887
|
function getLocalizedValue(value, locale) {
|
|
767
|
-
var
|
|
888
|
+
var _ref39, _ref40, _ref41, _ref42, _ref43, _ref44, _value$locale2;
|
|
768
889
|
if (value === undefined || value === null) return '';
|
|
769
890
|
if (_typeof(value) !== 'object') return stringify(value);
|
|
770
891
|
var dashedLocale = locale.replace('_', '-');
|
|
771
|
-
|
|
892
|
+
var underscoredLocale = locale.replace('-', '_');
|
|
893
|
+
return stringify((_ref39 = (_ref40 = (_ref41 = (_ref42 = (_ref43 = (_ref44 = (_value$locale2 = value[locale]) !== null && _value$locale2 !== void 0 ? _value$locale2 : value[dashedLocale]) !== null && _ref44 !== void 0 ? _ref44 : value[underscoredLocale]) !== null && _ref43 !== void 0 ? _ref43 : value.original) !== null && _ref42 !== void 0 ? _ref42 : value.auto) !== null && _ref41 !== void 0 ? _ref41 : value.default) !== null && _ref40 !== void 0 ? _ref40 : value.en) !== null && _ref39 !== void 0 ? _ref39 : '');
|
|
772
894
|
}
|
|
773
895
|
function serviceTypeToLabelKey(serviceType) {
|
|
774
896
|
var normalized = serviceType.toLowerCase();
|
|
@@ -793,6 +915,10 @@ function formatMoney(value, currencySymbol) {
|
|
|
793
915
|
var amount = new Decimal(toMoneyNumber(value));
|
|
794
916
|
return "".concat(currencySymbol).concat(amount.toFixed(2));
|
|
795
917
|
}
|
|
918
|
+
function formatNegativeMoney(value, currencySymbol) {
|
|
919
|
+
var amount = new Decimal(toMoneyNumber(value)).abs();
|
|
920
|
+
return "-".concat(currencySymbol).concat(amount.toFixed(2));
|
|
921
|
+
}
|
|
796
922
|
function calculateReceiptPaidAmount(order, summary) {
|
|
797
923
|
var _summary$pay_service_, _summary$total_amount;
|
|
798
924
|
var paidAmount = sumPayments(order.payments);
|
|
@@ -63,6 +63,9 @@ function preserveManualProductDiscountProducts(previousProducts, nextProducts) {
|
|
|
63
63
|
return previous && isBaseSalesManualProductDiscountProduct(previous) ? previous : product;
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
+
function isBaseSalesHistoricalDiscountEntry(discount) {
|
|
67
|
+
return Boolean((discount === null || discount === void 0 ? void 0 : discount.isEditMode) || (discount === null || discount === void 0 ? void 0 : discount.isDisabled) || (discount === null || discount === void 0 ? void 0 : discount.order_discount_id) != null);
|
|
68
|
+
}
|
|
66
69
|
function getBaseSalesUniqueArrayMetadataKey(key) {
|
|
67
70
|
if (key === 'products' || key === 'bookings') return 'unique_identification_number';
|
|
68
71
|
if (key === 'payments' || key === 'payment') return 'unique_payment_number';
|
|
@@ -1322,7 +1325,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1322
1325
|
return discount.id;
|
|
1323
1326
|
}));
|
|
1324
1327
|
return [].concat(_toConsumableArray(historyDiscountList), _toConsumableArray((discountList || []).filter(function (discount) {
|
|
1325
|
-
|
|
1328
|
+
if (!historyIds.has(discount.id)) return true;
|
|
1329
|
+
return !isBaseSalesHistoricalDiscountEntry(discount);
|
|
1326
1330
|
})));
|
|
1327
1331
|
}
|
|
1328
1332
|
}, {
|
|
@@ -1347,11 +1351,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1347
1351
|
key: "mergeCurrentDiscountSelectionState",
|
|
1348
1352
|
value: function mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
|
|
1349
1353
|
if (!currentDiscountList.length) return discountList;
|
|
1350
|
-
var currentDiscountMap = new Map(
|
|
1351
|
-
|
|
1352
|
-
|
|
1354
|
+
var currentDiscountMap = new Map();
|
|
1355
|
+
currentDiscountList.forEach(function (discount) {
|
|
1356
|
+
currentDiscountMap.set("".concat(discount.id, ":").concat(isBaseSalesHistoricalDiscountEntry(discount) ? 'historical' : 'runtime'), discount);
|
|
1357
|
+
});
|
|
1353
1358
|
return discountList.map(function (discount) {
|
|
1354
|
-
var currentDiscount = currentDiscountMap.get(discount.id);
|
|
1359
|
+
var currentDiscount = currentDiscountMap.get("".concat(discount.id, ":").concat(isBaseSalesHistoricalDiscountEntry(discount) ? 'historical' : 'runtime'));
|
|
1355
1360
|
if (!currentDiscount) return discount;
|
|
1356
1361
|
if (currentDiscount.isManualSelect) {
|
|
1357
1362
|
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
@@ -1731,7 +1736,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1731
1736
|
case 3:
|
|
1732
1737
|
list = this.store.order.getDiscountList();
|
|
1733
1738
|
updated = list.map(function (d) {
|
|
1734
|
-
return d.id === params.discountId ? _objectSpread(_objectSpread({}, d), {}, {
|
|
1739
|
+
return d.id === params.discountId && !isBaseSalesHistoricalDiscountEntry(d) ? _objectSpread(_objectSpread({}, d), {}, {
|
|
1735
1740
|
isSelected: params.isSelected,
|
|
1736
1741
|
isManualSelect: !params.isSelected
|
|
1737
1742
|
}) : d;
|
|
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
322
322
|
* 获取当前的客户搜索条件
|
|
323
323
|
* @returns 当前搜索条件
|
|
324
324
|
*/
|
|
325
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
325
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
326
326
|
/**
|
|
327
327
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
328
328
|
* @returns 客户状态
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -26,6 +26,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
26
26
|
private giftSelectResolver;
|
|
27
27
|
/** applyPromotion 递归保护 flag(写路径同步调 applyPromotion,禁止重入) */
|
|
28
28
|
private isApplyingPromotion;
|
|
29
|
+
/** 商品曾应用过客户券卡,客户变更剥离后需强制跑一次 calcDiscount 复位价格 */
|
|
30
|
+
private hasActiveCustomerBoundDiscount;
|
|
29
31
|
/** 最近一次 applyPromotion 的未满足促销提示 */
|
|
30
32
|
private lastUnfulfilledPromotions;
|
|
31
33
|
/** 最近一次 applyPromotion 的赠品操作 diff(debug / SDK 读取使用) */
|
|
@@ -258,6 +260,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
258
260
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
259
261
|
private buildTempOrderCustomer;
|
|
260
262
|
private isCustomerBoundDiscount;
|
|
263
|
+
private productHasCustomerBoundDiscount;
|
|
264
|
+
private shouldSkipDiscountCalculation;
|
|
261
265
|
private clearCustomerBoundDiscounts;
|
|
262
266
|
/**
|
|
263
267
|
* 更新当前 tempOrder 的客户协议字段。
|
|
@@ -476,6 +480,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
476
480
|
recalcOnHydrate?: boolean;
|
|
477
481
|
}): Promise<OrderTempOrder>;
|
|
478
482
|
private normalizeTempOrderForRuntime;
|
|
483
|
+
private hydrateLinkedBookingIdentity;
|
|
479
484
|
private pickHydratedDisplayText;
|
|
480
485
|
private formatHydratedNamePair;
|
|
481
486
|
private buildHydratedProductOptionString;
|