@pisell/pisellos 2.2.183 → 2.2.185
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/promotion/evaluator.js +3 -2
- package/dist/modules/Order/index.d.ts +3 -1
- package/dist/modules/Order/index.js +59 -17
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BaseSales/index.js +38 -39
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +12 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +271 -130
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +9 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
- package/lib/modules/Order/index.d.ts +3 -1
- package/lib/modules/Order/index.js +59 -15
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BaseSales/index.js +0 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +12 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +118 -12
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +7 -0
- package/package.json +1 -1
|
@@ -747,9 +747,10 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
747
747
|
return b.price - a.price;
|
|
748
748
|
});
|
|
749
749
|
|
|
750
|
-
// 3.
|
|
750
|
+
// 3. 计算可以凑成多少组(cumulative 缺省视为 true,与 adapter 一致)
|
|
751
751
|
var totalUnits = unitProducts.length;
|
|
752
|
-
var
|
|
752
|
+
var isCumulative = cumulative !== false;
|
|
753
|
+
var groupCount = isCumulative ? Math.floor(totalUnits / x) : totalUnits >= x ? 1 : 0;
|
|
753
754
|
var promotionUnits = groupCount * x;
|
|
754
755
|
|
|
755
756
|
// 4. 分离参与促销的和不参与的商品
|
|
@@ -264,7 +264,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
264
264
|
private logSubmitBackendRejected;
|
|
265
265
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
266
266
|
createOrder(params: CommitOrderParams['query']): {
|
|
267
|
-
type: "
|
|
267
|
+
type: "appointment_booking" | "virtual";
|
|
268
268
|
platform: string;
|
|
269
269
|
sales_channel: string;
|
|
270
270
|
order_sales_channel: string;
|
|
@@ -312,6 +312,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
312
312
|
recalcOnHydrate?: boolean;
|
|
313
313
|
}): Promise<OrderTempOrder>;
|
|
314
314
|
private normalizeTempOrderForRuntime;
|
|
315
|
+
private normalizeHydratedProductOptionItem;
|
|
316
|
+
private resolveHydratedProductOptions;
|
|
315
317
|
private normalizeHydratedOrderProduct;
|
|
316
318
|
getLastOrderInfo(): Record<string, any> | undefined;
|
|
317
319
|
getOrderInfo(order_id: number): Promise<any>;
|
|
@@ -2108,7 +2108,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2108
2108
|
}) : null;
|
|
2109
2109
|
productToAdd = (linked === null || linked === void 0 ? void 0 : linked.product) || product;
|
|
2110
2110
|
incomingFingerprint = buildProductLineFingerprint(productToAdd.product_option_item, productToAdd.product_bundle);
|
|
2111
|
-
normalizedIncoming = normalizeOrderProduct(productToAdd);
|
|
2111
|
+
normalizedIncoming = mergeOrderProductDisplayFields(productToAdd, normalizeOrderProduct(productToAdd));
|
|
2112
2112
|
normalizedIncoming.discount_list = normalizeOrderProductDiscountList(normalizedIncoming.discount_list);
|
|
2113
2113
|
hasIncomingGoodPass = this.hasGoodPassDiscount(normalizedIncoming);
|
|
2114
2114
|
shouldForceNewLine = !!booking;
|
|
@@ -2156,11 +2156,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2156
2156
|
} else {
|
|
2157
2157
|
targetProduct = matchedProduct;
|
|
2158
2158
|
targetUid = (_targetProduct$metada = targetProduct.metadata) === null || _targetProduct$metada === void 0 ? void 0 : _targetProduct$metada.unique_identification_number;
|
|
2159
|
-
normalizedProduct = normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
|
|
2159
|
+
normalizedProduct = mergeOrderProductDisplayFields(targetProduct, normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
|
|
2160
2160
|
metadata: _objectSpread(_objectSpread({}, productToAdd.metadata || {}), {}, {
|
|
2161
2161
|
unique_identification_number: targetUid
|
|
2162
2162
|
})
|
|
2163
|
-
}));
|
|
2163
|
+
})));
|
|
2164
2164
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
2165
2165
|
tempOrder.products[matchedIndex] = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), normalizedProduct), {}, {
|
|
2166
2166
|
metadata: _objectSpread(_objectSpread(_objectSpread({}, targetProduct.metadata || {}), normalizedProduct.metadata || {}), {}, {
|
|
@@ -2220,8 +2220,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2220
2220
|
key: "updateOrderProduct",
|
|
2221
2221
|
value: function () {
|
|
2222
2222
|
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
2223
|
-
var _targetProduct$metada2, _metadata, _metadata2, _metadata3, _tempOrder$products$p;
|
|
2224
|
-
var product_id, product_variant_id, updates, unique_identification_number, identity_key, product_option_item, product_bundle, booking, tempOrder, identityLookup, productIndex, targetUid, targetProduct, nextProduct, callerUpdatesTopPrice, callerUpdatesMainMeta, existedMeta, normalizedProduct, _normalizedProduct$me, _targetProduct$
|
|
2223
|
+
var _targetProduct$metada2, _metadata, _metadata2, _metadata3, _nextProduct$metadata, _targetProduct$metada3, _tempOrder$products$p;
|
|
2224
|
+
var product_id, product_variant_id, updates, unique_identification_number, identity_key, product_option_item, product_bundle, booking, tempOrder, identityLookup, productIndex, targetUid, targetProduct, nextProduct, callerUpdatesTopPrice, callerUpdatesMainMeta, existedMeta, normalizedProduct, preservedBookingUid, _normalizedProduct$me, _targetProduct$metada4, productUid, linked;
|
|
2225
2225
|
return _regeneratorRuntime().wrap(function _callee17$(_context19) {
|
|
2226
2226
|
while (1) switch (_context19.prev = _context19.next) {
|
|
2227
2227
|
case 0:
|
|
@@ -2286,10 +2286,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2286
2286
|
}
|
|
2287
2287
|
// normalizeOrderProduct 幂等:v2 metadata 存在 → 保留 main_product_* 折扣重算 composite;
|
|
2288
2288
|
// 否则 → 把顶层 selling_price 视作 source,派生 main_product_* 并写 price_schema_version: 2。
|
|
2289
|
-
normalizedProduct = normalizeOrderProduct(nextProduct);
|
|
2289
|
+
normalizedProduct = mergeOrderProductDisplayFields(nextProduct, normalizeOrderProduct(nextProduct));
|
|
2290
2290
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
2291
|
+
preservedBookingUid = nextProduct.booking_uid || ((_nextProduct$metadata = nextProduct.metadata) === null || _nextProduct$metadata === void 0 ? void 0 : _nextProduct$metadata.booking_uid) || targetProduct.booking_uid || ((_targetProduct$metada3 = targetProduct.metadata) === null || _targetProduct$metada3 === void 0 ? void 0 : _targetProduct$metada3.booking_uid);
|
|
2292
|
+
if (!booking && preservedBookingUid) {
|
|
2293
|
+
normalizedProduct.booking_uid = preservedBookingUid;
|
|
2294
|
+
normalizedProduct.metadata = _objectSpread(_objectSpread({}, normalizedProduct.metadata || {}), {}, {
|
|
2295
|
+
booking_uid: preservedBookingUid
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2291
2298
|
if (booking) {
|
|
2292
|
-
productUid = String(((_normalizedProduct$me = normalizedProduct.metadata) === null || _normalizedProduct$me === void 0 ? void 0 : _normalizedProduct$me.unique_identification_number) || ((_targetProduct$
|
|
2299
|
+
productUid = String(((_normalizedProduct$me = normalizedProduct.metadata) === null || _normalizedProduct$me === void 0 ? void 0 : _normalizedProduct$me.unique_identification_number) || ((_targetProduct$metada4 = targetProduct.metadata) === null || _targetProduct$metada4 === void 0 ? void 0 : _targetProduct$metada4.unique_identification_number) || unique_identification_number || createUuidV4());
|
|
2293
2300
|
normalizedProduct.metadata = _objectSpread(_objectSpread({}, normalizedProduct.metadata || {}), {}, {
|
|
2294
2301
|
unique_identification_number: productUid
|
|
2295
2302
|
});
|
|
@@ -2311,18 +2318,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2311
2318
|
}
|
|
2312
2319
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
2313
2320
|
this.captureProductRuntime(tempOrder, updates, tempOrder.products[productIndex], (_tempOrder$products$p = tempOrder.products[productIndex].metadata) === null || _tempOrder$products$p === void 0 ? void 0 : _tempOrder$products$p.unique_identification_number);
|
|
2314
|
-
_context19.next =
|
|
2321
|
+
_context19.next = 27;
|
|
2315
2322
|
return this.applyPromotion();
|
|
2316
|
-
case
|
|
2323
|
+
case 27:
|
|
2317
2324
|
this.applyDiscount();
|
|
2318
|
-
_context19.next =
|
|
2325
|
+
_context19.next = 30;
|
|
2319
2326
|
return this.recalculateSummary({
|
|
2320
2327
|
createIfMissing: true
|
|
2321
2328
|
});
|
|
2322
|
-
case
|
|
2329
|
+
case 30:
|
|
2323
2330
|
this.persistTempOrder();
|
|
2324
2331
|
return _context19.abrupt("return", tempOrder.products);
|
|
2325
|
-
case
|
|
2332
|
+
case 32:
|
|
2326
2333
|
case "end":
|
|
2327
2334
|
return _context19.stop();
|
|
2328
2335
|
}
|
|
@@ -2337,7 +2344,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2337
2344
|
key: "updateOrderProductQuantity",
|
|
2338
2345
|
value: function () {
|
|
2339
2346
|
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
2340
|
-
var _targetProduct$
|
|
2347
|
+
var _targetProduct$metada5;
|
|
2341
2348
|
var product_id, product_variant_id, num, unique_identification_number, identity_key, product_option_item, product_bundle, tempOrder, identityLookup, productIndex, targetUid, targetProduct, normalizedProduct;
|
|
2342
2349
|
return _regeneratorRuntime().wrap(function _callee18$(_context20) {
|
|
2343
2350
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -2378,7 +2385,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2378
2385
|
normalizedProduct = normalizeOrderProduct(_objectSpread(_objectSpread({}, targetProduct), {}, {
|
|
2379
2386
|
num: getSafeProductNum(num),
|
|
2380
2387
|
metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
|
|
2381
|
-
unique_identification_number: ((_targetProduct$
|
|
2388
|
+
unique_identification_number: ((_targetProduct$metada5 = targetProduct.metadata) === null || _targetProduct$metada5 === void 0 ? void 0 : _targetProduct$metada5.unique_identification_number) || unique_identification_number
|
|
2382
2389
|
})
|
|
2383
2390
|
}));
|
|
2384
2391
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
@@ -3187,6 +3194,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3187
3194
|
_context32.next = 2;
|
|
3188
3195
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
3189
3196
|
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info']
|
|
3197
|
+
}, {
|
|
3198
|
+
osServer: true
|
|
3190
3199
|
});
|
|
3191
3200
|
case 2:
|
|
3192
3201
|
res = _context32.sent;
|
|
@@ -3299,6 +3308,35 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3299
3308
|
nextTempOrder.vouchers = raw.vouchers || [];
|
|
3300
3309
|
return nextTempOrder;
|
|
3301
3310
|
}
|
|
3311
|
+
}, {
|
|
3312
|
+
key: "normalizeHydratedProductOptionItem",
|
|
3313
|
+
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
3314
|
+
var _ref23, _optionItem$num, _ref24, _optionItem$price;
|
|
3315
|
+
var rawNum = (_ref23 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref23 !== void 0 ? _ref23 : 1;
|
|
3316
|
+
var parsedNum = Number(rawNum);
|
|
3317
|
+
var rawPrice = (_ref24 = (_optionItem$price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _optionItem$price !== void 0 ? _optionItem$price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _ref24 !== void 0 ? _ref24 : 0;
|
|
3318
|
+
var parsedPrice = Number(rawPrice);
|
|
3319
|
+
return {
|
|
3320
|
+
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
3321
|
+
option_group_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_id,
|
|
3322
|
+
num: Number.isFinite(parsedNum) && parsedNum > 0 ? parsedNum : 1,
|
|
3323
|
+
price: Number.isFinite(parsedPrice) ? parsedPrice : 0
|
|
3324
|
+
};
|
|
3325
|
+
}
|
|
3326
|
+
}, {
|
|
3327
|
+
key: "resolveHydratedProductOptions",
|
|
3328
|
+
value: function resolveHydratedProductOptions(row) {
|
|
3329
|
+
var _row$product_sku,
|
|
3330
|
+
_this11 = this;
|
|
3331
|
+
if (Array.isArray(row.product_option_item) && row.product_option_item.length > 0) {
|
|
3332
|
+
return row.product_option_item;
|
|
3333
|
+
}
|
|
3334
|
+
var skuOptions = (_row$product_sku = row.product_sku) === null || _row$product_sku === void 0 ? void 0 : _row$product_sku.option;
|
|
3335
|
+
if (!Array.isArray(skuOptions)) return [];
|
|
3336
|
+
return skuOptions.map(function (optionItem) {
|
|
3337
|
+
return _this11.normalizeHydratedProductOptionItem(optionItem || {});
|
|
3338
|
+
});
|
|
3339
|
+
}
|
|
3302
3340
|
}, {
|
|
3303
3341
|
key: "normalizeHydratedOrderProduct",
|
|
3304
3342
|
value: function normalizeHydratedOrderProduct(product) {
|
|
@@ -3306,9 +3344,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3306
3344
|
if (row.num === undefined && row.product_quantity !== undefined) {
|
|
3307
3345
|
row.num = row.product_quantity;
|
|
3308
3346
|
}
|
|
3309
|
-
|
|
3347
|
+
row.product_option_item = this.resolveHydratedProductOptions(row);
|
|
3310
3348
|
if (!Array.isArray(row.product_bundle)) row.product_bundle = [];
|
|
3311
3349
|
if (!row.metadata || _typeof(row.metadata) !== 'object') row.metadata = {};
|
|
3350
|
+
if (row.booking_uid && !row.metadata.booking_uid) {
|
|
3351
|
+
row.metadata.booking_uid = row.booking_uid;
|
|
3352
|
+
}
|
|
3312
3353
|
var existingIdentity = row.metadata.unique_identification_number || row.unique_identification_number;
|
|
3313
3354
|
if (!existingIdentity) {
|
|
3314
3355
|
row.metadata.unique_identification_number = createUuidV4();
|
|
@@ -3316,6 +3357,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3316
3357
|
var normalized = normalizeOrderProduct(row);
|
|
3317
3358
|
normalized.discount_list = normalizeOrderProductDiscountList(normalized.discount_list);
|
|
3318
3359
|
var result = _objectSpread(_objectSpread(_objectSpread({}, row), normalized), {}, {
|
|
3360
|
+
product_sku: row.product_sku,
|
|
3319
3361
|
metadata: _objectSpread(_objectSpread({}, row.metadata), normalized.metadata)
|
|
3320
3362
|
});
|
|
3321
3363
|
if (result.metadata) delete result.metadata.price_schema_version;
|
|
@@ -3392,9 +3434,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3392
3434
|
_step11;
|
|
3393
3435
|
try {
|
|
3394
3436
|
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
3395
|
-
var
|
|
3437
|
+
var _ref25, _bundle$num;
|
|
3396
3438
|
var bundle = _step11.value;
|
|
3397
|
-
var bundleQty = new Decimal(Number(qty) || 1).times(Number((
|
|
3439
|
+
var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref25 = (_bundle$num = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref25 !== void 0 ? _ref25 : 1) || 1).toNumber();
|
|
3398
3440
|
var _iterator12 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
3399
3441
|
_step12;
|
|
3400
3442
|
try {
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -606,103 +606,102 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
606
606
|
orderId: orderIdOrParams
|
|
607
607
|
};
|
|
608
608
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
609
|
-
debugger;
|
|
610
609
|
if (params.forceRemote) {
|
|
611
|
-
_context5.next =
|
|
610
|
+
_context5.next = 35;
|
|
612
611
|
break;
|
|
613
612
|
}
|
|
614
613
|
if (!(params.orderId !== undefined)) {
|
|
615
|
-
_context5.next =
|
|
614
|
+
_context5.next = 11;
|
|
616
615
|
break;
|
|
617
616
|
}
|
|
618
|
-
_context5.next =
|
|
617
|
+
_context5.next = 8;
|
|
619
618
|
return this.store.order.getLocalOrderByOrderId(params.orderId);
|
|
620
|
-
case
|
|
619
|
+
case 8:
|
|
621
620
|
_context5.t0 = _context5.sent;
|
|
622
|
-
_context5.next =
|
|
621
|
+
_context5.next = 26;
|
|
623
622
|
break;
|
|
624
|
-
case
|
|
623
|
+
case 11:
|
|
625
624
|
if (!externalSaleNumber) {
|
|
626
|
-
_context5.next =
|
|
625
|
+
_context5.next = 17;
|
|
627
626
|
break;
|
|
628
627
|
}
|
|
629
|
-
_context5.next =
|
|
628
|
+
_context5.next = 14;
|
|
630
629
|
return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
|
|
631
|
-
case
|
|
630
|
+
case 14:
|
|
632
631
|
_context5.t1 = _context5.sent;
|
|
633
|
-
_context5.next =
|
|
632
|
+
_context5.next = 25;
|
|
634
633
|
break;
|
|
635
|
-
case
|
|
634
|
+
case 17:
|
|
636
635
|
if (!params.orderNumber) {
|
|
637
|
-
_context5.next =
|
|
636
|
+
_context5.next = 23;
|
|
638
637
|
break;
|
|
639
638
|
}
|
|
640
|
-
_context5.next =
|
|
639
|
+
_context5.next = 20;
|
|
641
640
|
return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
|
|
642
|
-
case
|
|
641
|
+
case 20:
|
|
643
642
|
_context5.t2 = _context5.sent;
|
|
644
|
-
_context5.next =
|
|
643
|
+
_context5.next = 24;
|
|
645
644
|
break;
|
|
646
|
-
case
|
|
645
|
+
case 23:
|
|
647
646
|
_context5.t2 = null;
|
|
648
|
-
case
|
|
647
|
+
case 24:
|
|
649
648
|
_context5.t1 = _context5.t2;
|
|
650
|
-
case
|
|
649
|
+
case 25:
|
|
651
650
|
_context5.t0 = _context5.t1;
|
|
652
|
-
case
|
|
651
|
+
case 26:
|
|
653
652
|
localRecord = _context5.t0;
|
|
654
653
|
if (!localRecord) {
|
|
655
|
-
_context5.next =
|
|
654
|
+
_context5.next = 35;
|
|
656
655
|
break;
|
|
657
656
|
}
|
|
658
|
-
_context5.next =
|
|
657
|
+
_context5.next = 30;
|
|
659
658
|
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
660
659
|
recalcOnHydrate: false
|
|
661
660
|
});
|
|
662
|
-
case
|
|
661
|
+
case 30:
|
|
663
662
|
_sales = _context5.sent;
|
|
664
663
|
this.currentSalesDetail = _sales;
|
|
665
|
-
_context5.next =
|
|
664
|
+
_context5.next = 34;
|
|
666
665
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
667
666
|
sales: _sales
|
|
668
667
|
});
|
|
669
|
-
case
|
|
668
|
+
case 34:
|
|
670
669
|
return _context5.abrupt("return", _sales);
|
|
671
|
-
case
|
|
670
|
+
case 35:
|
|
672
671
|
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
673
|
-
_context5.next =
|
|
672
|
+
_context5.next = 37;
|
|
674
673
|
break;
|
|
675
674
|
}
|
|
676
675
|
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
677
|
-
case
|
|
678
|
-
_context5.next =
|
|
676
|
+
case 37:
|
|
677
|
+
_context5.next = 39;
|
|
679
678
|
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
680
|
-
case
|
|
679
|
+
case 39:
|
|
681
680
|
res = _context5.sent;
|
|
682
681
|
if (!(!res || res.code !== 200)) {
|
|
683
|
-
_context5.next =
|
|
682
|
+
_context5.next = 43;
|
|
684
683
|
break;
|
|
685
684
|
}
|
|
686
685
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
|
|
687
686
|
throw new Error(message);
|
|
688
|
-
case
|
|
689
|
-
_context5.next =
|
|
687
|
+
case 43:
|
|
688
|
+
_context5.next = 45;
|
|
690
689
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
691
690
|
recalcOnHydrate: false
|
|
692
691
|
});
|
|
693
|
-
case
|
|
692
|
+
case 45:
|
|
694
693
|
sales = _context5.sent;
|
|
695
|
-
_context5.next =
|
|
694
|
+
_context5.next = 48;
|
|
696
695
|
return this.store.order.saveDraft();
|
|
697
|
-
case
|
|
696
|
+
case 48:
|
|
698
697
|
this.currentSalesDetail = sales;
|
|
699
|
-
_context5.next =
|
|
698
|
+
_context5.next = 51;
|
|
700
699
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
701
700
|
sales: sales
|
|
702
701
|
});
|
|
703
|
-
case
|
|
702
|
+
case 51:
|
|
704
703
|
return _context5.abrupt("return", sales);
|
|
705
|
-
case
|
|
704
|
+
case 52:
|
|
706
705
|
case "end":
|
|
707
706
|
return _context5.stop();
|
|
708
707
|
}
|
|
@@ -176,6 +176,18 @@ export declare function getOrderProductOriginalPriceForPromotion(product: any):
|
|
|
176
176
|
export declare function mergeIdenticalPromotionCartLines(products: any[]): any[];
|
|
177
177
|
/** 获取行 uid(统一以 `metadata.unique_identification_number` 为唯一键) */
|
|
178
178
|
export declare function getOrderProductUid(product: any): string;
|
|
179
|
+
/**
|
|
180
|
+
* 促销评估前合并同 SKU 拆分行(含促销/原价行),避免加购后仅前 2 件享受优惠。
|
|
181
|
+
* 带 `booking_uid` 的预约行不参与合并(每次加车独立 booking + 商品行)。
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* consolidateMainProductsForPromotion([
|
|
185
|
+
* { item: promoLineNum2, originalListIndex: 0 },
|
|
186
|
+
* { item: regularLineNum2, originalListIndex: 1 },
|
|
187
|
+
* ]);
|
|
188
|
+
* // => 单行 num=4,清除 _promotion 后重新评估
|
|
189
|
+
*/
|
|
190
|
+
export declare function buildConsolidateKeyForPromotion(item: any): string;
|
|
179
191
|
/**
|
|
180
192
|
* 从策略配置的 product_match 规则提取可参与商品列表。
|
|
181
193
|
*
|