@pisell/pisellos 2.2.197 → 2.2.199
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/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +7 -3
- package/dist/modules/Cart/utils/cartProduct.js +11 -1
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Order/index.d.ts +16 -0
- package/dist/modules/Order/index.js +1232 -568
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Order/utils.d.ts +33 -2
- package/dist/modules/Order/utils.js +112 -55
- package/dist/modules/Payment/walletpass.js +14 -7
- package/dist/modules/SalesSummary/utils.js +394 -149
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +294 -190
- package/dist/server/modules/order/index.d.ts +8 -0
- package/dist/server/modules/order/index.js +536 -317
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +2 -1
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +19 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +26 -9
- package/dist/solution/VenueBooking/index.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +4 -1
- package/lib/modules/Cart/utils/cartProduct.js +11 -1
- package/lib/modules/Cart/utils/changePrice.js +12 -20
- package/lib/modules/Order/index.d.ts +16 -0
- package/lib/modules/Order/index.js +525 -18
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Order/utils.d.ts +33 -2
- package/lib/modules/Order/utils.js +44 -9
- package/lib/modules/Payment/walletpass.js +7 -3
- package/lib/modules/SalesSummary/utils.js +256 -46
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +82 -3
- package/lib/server/modules/order/index.d.ts +8 -0
- package/lib/server/modules/order/index.js +106 -4
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +2 -1
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +28 -10
- package/lib/solution/VenueBooking/index.js +2 -1
- package/package.json +1 -1
|
@@ -61,10 +61,14 @@ function mapOrderBundleToOtherBundle(bundle) {
|
|
|
61
61
|
var selling = (_ref3 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref3 !== void 0 ? _ref3 : catalogOriginal;
|
|
62
62
|
var _omitBundleSelling = item.bundle_selling_price,
|
|
63
63
|
rest = _objectWithoutProperties(item, _excluded);
|
|
64
|
-
|
|
64
|
+
var isMarkupOrMarkdown = (item.price_type === 'markdown' || item.price_type === 'markup') && (item.price_type_ext === '' || item.price_type_ext === undefined || item.price_type_ext === null);
|
|
65
|
+
if (isMarkupOrMarkdown) delete rest.original_total;
|
|
66
|
+
return _objectSpread(_objectSpread(_objectSpread({}, rest), {}, {
|
|
65
67
|
price: selling,
|
|
66
|
-
original_price: catalogOriginal
|
|
67
|
-
|
|
68
|
+
original_price: catalogOriginal
|
|
69
|
+
}, isMarkupOrMarkdown ? {} : {
|
|
70
|
+
original_total: (_item$original_total = item.original_total) !== null && _item$original_total !== void 0 ? _item$original_total : catalogOriginal
|
|
71
|
+
}), {}, {
|
|
68
72
|
num: (_ref4 = (_item$num = item.num) !== null && _item$num !== void 0 ? _item$num : item.quantity) !== null && _ref4 !== void 0 ? _ref4 : 1,
|
|
69
73
|
quantity: (_ref5 = (_item$quantity = item.quantity) !== null && _item$quantity !== void 0 ? _item$quantity : item.num) !== null && _ref5 !== void 0 ? _ref5 : 1
|
|
70
74
|
});
|
|
@@ -14,6 +14,7 @@ import Decimal from 'decimal.js';
|
|
|
14
14
|
import { isNormalProduct } from "../../Product/utils";
|
|
15
15
|
import { getDiscountAmount } from "../../../solution/ShopDiscount/utils";
|
|
16
16
|
import { calcDiscountListDifference } from "../../Summary/utils";
|
|
17
|
+
import { getBundleSellingMagnitude } from "../../Order/utils";
|
|
17
18
|
|
|
18
19
|
/** 与 Rules / ShopDiscount 一致的折扣入参,用于主价与 option 单价 */
|
|
19
20
|
var toDiscountPayload = function toDiscountPayload(discountItem) {
|
|
@@ -374,6 +375,7 @@ export var formatBundle = function formatBundle(bundle) {
|
|
|
374
375
|
export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
|
|
375
376
|
if (!(bundle !== null && bundle !== void 0 && bundle.length)) return [];
|
|
376
377
|
return bundle.map(function (d) {
|
|
378
|
+
var _d$price, _d$price_type, _d$price_type_ext;
|
|
377
379
|
var getBundleValueByKey = function getBundleValueByKey(key) {
|
|
378
380
|
var _d$originBundleItem;
|
|
379
381
|
return (d === null || d === void 0 ? void 0 : d[key]) || (d === null || d === void 0 || (_d$originBundleItem = d.originBundleItem) === null || _d$originBundleItem === void 0 ? void 0 : _d$originBundleItem[key]);
|
|
@@ -382,6 +384,14 @@ export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
|
|
|
382
384
|
var _cur$metadata2;
|
|
383
385
|
return pre + ((cur === null || cur === void 0 || (_cur$metadata2 = cur.metadata) === null || _cur$metadata2 === void 0 ? void 0 : _cur$metadata2.product_discount_difference) || 0);
|
|
384
386
|
}, 0);
|
|
387
|
+
var normalizedBundle = _objectSpread(_objectSpread({}, d), {}, {
|
|
388
|
+
// 计算 markdown 净额时只传真实毛价;若仅有 bundle_selling_price,则由 helper 当历史净额兜底。
|
|
389
|
+
price: (_d$price = d === null || d === void 0 ? void 0 : d.price) !== null && _d$price !== void 0 ? _d$price : d === null || d === void 0 ? void 0 : d.custom_price,
|
|
390
|
+
bundle_selling_price: d === null || d === void 0 ? void 0 : d.bundle_selling_price,
|
|
391
|
+
price_type: (_d$price_type = d === null || d === void 0 ? void 0 : d.price_type) !== null && _d$price_type !== void 0 ? _d$price_type : d === null || d === void 0 ? void 0 : d.custom_price_type,
|
|
392
|
+
price_type_ext: (_d$price_type_ext = d === null || d === void 0 ? void 0 : d.price_type_ext) !== null && _d$price_type_ext !== void 0 ? _d$price_type_ext : d === null || d === void 0 ? void 0 : d.custom_price_type_ext,
|
|
393
|
+
option: getBundleValueByKey('option')
|
|
394
|
+
});
|
|
385
395
|
return {
|
|
386
396
|
bundle_group_id: getBundleValueByKey('group_id'),
|
|
387
397
|
bundle_id: d.id,
|
|
@@ -392,7 +402,7 @@ export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
|
|
|
392
402
|
extension_type: getBundleValueByKey('extension_type'),
|
|
393
403
|
option: formatOptionsToOrigin(getBundleValueByKey('option')),
|
|
394
404
|
discount_list: d.discount_list,
|
|
395
|
-
"bundle_selling_price":
|
|
405
|
+
"bundle_selling_price": getBundleSellingMagnitude(normalizedBundle).toFixed(2),
|
|
396
406
|
"custom_price": d === null || d === void 0 ? void 0 : d.price,
|
|
397
407
|
metadata: {
|
|
398
408
|
custom_product_bundle_map_id: d._id,
|
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
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; }
|
|
11
11
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
12
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
|
-
import
|
|
13
|
+
import { getBundleSellingMagnitude } from "../../Order/utils";
|
|
14
14
|
export function updateAllCartItemPrice(_x, _x2, _x3, _x4, _x5) {
|
|
15
15
|
return _updateAllCartItemPrice.apply(this, arguments);
|
|
16
16
|
}
|
|
@@ -54,18 +54,18 @@ function _updateAllCartItemPrice() {
|
|
|
54
54
|
var targetBundleItem = targetBundle.bundle_item.find(function (m) {
|
|
55
55
|
return m.id === n.id;
|
|
56
56
|
});
|
|
57
|
-
if (targetBundleItem.price_type === 'markdown') {
|
|
58
|
-
targetBundleItem.price = new Decimal(targetBundleItem.price || 0).mul(-1).toNumber();
|
|
59
|
-
}
|
|
60
|
-
// 如果有选择 option,还需要加上 option 的价格
|
|
61
|
-
if (n.option) {
|
|
62
|
-
targetBundleItem.price = new Decimal(targetBundleItem.price || 0).add(n.option.reduce(function (pre, cur) {
|
|
63
|
-
return pre + new Decimal(cur.price || 0).mul(cur.num || 1).toNumber();
|
|
64
|
-
}, 0)).toNumber();
|
|
65
|
-
}
|
|
66
57
|
if (targetBundleItem) {
|
|
67
|
-
|
|
58
|
+
var normalizedBundle = _objectSpread(_objectSpread({}, n), {}, {
|
|
68
59
|
price: targetBundleItem.price,
|
|
60
|
+
custom_price: targetBundleItem.price,
|
|
61
|
+
price_type: targetBundleItem.price_type,
|
|
62
|
+
price_type_ext: targetBundleItem.price_type_ext
|
|
63
|
+
});
|
|
64
|
+
var bundleSellingPrice = getBundleSellingMagnitude(normalizedBundle).toFixed(2);
|
|
65
|
+
return _objectSpread(_objectSpread({}, n), {}, {
|
|
66
|
+
custom_price: targetBundleItem.price,
|
|
67
|
+
price: targetBundleItem.price_type === 'markdown' ? bundleSellingPrice : targetBundleItem.price,
|
|
68
|
+
bundle_selling_price: bundleSellingPrice,
|
|
69
69
|
base_price: targetBundleItem.base_price
|
|
70
70
|
});
|
|
71
71
|
}
|
|
@@ -34,6 +34,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
34
34
|
* BigSale 弹窗等短生命周期场景通过 setEnableTempOrderPersist(false) 关闭。
|
|
35
35
|
*/
|
|
36
36
|
private draftPersistEnabled;
|
|
37
|
+
private collectHydratedEditDiscounts;
|
|
37
38
|
/**
|
|
38
39
|
* Populate `savedAmount` on each discount based on product-level discount details.
|
|
39
40
|
* Only selected discounts get a non-zero value.
|
|
@@ -63,6 +64,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
63
64
|
apply?: boolean;
|
|
64
65
|
}): Promise<Discount[]>;
|
|
65
66
|
getDiscountList(): Discount[];
|
|
67
|
+
private ensureEditDiscountConfigForProductChange;
|
|
66
68
|
scanCode(code: string, customerId?: number): Promise<{
|
|
67
69
|
isAvailable: boolean;
|
|
68
70
|
discountList: Discount[];
|
|
@@ -147,11 +149,21 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
147
149
|
private calculatePaidPaymentSummary;
|
|
148
150
|
private calculatePaymentServiceFee;
|
|
149
151
|
private calculatePaymentGapAmount;
|
|
152
|
+
private calculatePaymentRoundingAmount;
|
|
150
153
|
private formatSummaryMetadataMoney;
|
|
151
154
|
private syncSummaryProductMetadata;
|
|
152
155
|
private calculateSummaryAmountGap;
|
|
153
156
|
private getSummaryRefundAmount;
|
|
154
157
|
private calculatePaymentTargetAmount;
|
|
158
|
+
private normalizeFingerprintMoney;
|
|
159
|
+
private normalizeFingerprintValue;
|
|
160
|
+
private buildProductFingerprintItem;
|
|
161
|
+
private buildOrderProductsFingerprint;
|
|
162
|
+
private buildProductStructuralFingerprintItem;
|
|
163
|
+
private buildOrderProductsStructuralFingerprint;
|
|
164
|
+
private getOriginalSalesSnapshot;
|
|
165
|
+
private restoreOriginalSnapshotIfProductsUnchanged;
|
|
166
|
+
private clearPersistedAmountFieldsForFullRecalc;
|
|
155
167
|
private getPaymentTargetAmount;
|
|
156
168
|
ensureTempOrder(): OrderTempOrder;
|
|
157
169
|
restoreOrder(): OrderTempOrder;
|
|
@@ -186,6 +198,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
186
198
|
updateTempOrderBuzzer(buzzer: string): string;
|
|
187
199
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
188
200
|
private buildTempOrderCustomer;
|
|
201
|
+
private isCustomerBoundDiscount;
|
|
202
|
+
private clearCustomerBoundDiscounts;
|
|
189
203
|
/**
|
|
190
204
|
* 更新当前 tempOrder 的客户协议字段。
|
|
191
205
|
*
|
|
@@ -234,6 +248,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
234
248
|
private shouldMergeProductToOrder;
|
|
235
249
|
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
|
|
236
250
|
private hasGoodPassDiscount;
|
|
251
|
+
private getBundleRuntimeIdentity;
|
|
252
|
+
private preservePersistedBundlePriceFields;
|
|
237
253
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
|
|
238
254
|
updateOrderProductQuantity(params: UpdateOrderProductQuantityParams): Promise<OrderProduct[]>;
|
|
239
255
|
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|