@pisell/pisellos 2.2.165 → 2.2.166
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.js +3 -0
- package/dist/modules/Order/types.d.ts +0 -5
- package/dist/modules/Order/utils.d.ts +5 -2
- package/dist/modules/Order/utils.js +6 -4
- package/dist/solution/BaseSales/index.js +9 -1
- package/dist/solution/BookingTicket/index.js +23 -8
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.js +22 -12
- package/lib/modules/Order/index.js +3 -0
- package/lib/modules/Order/types.d.ts +0 -5
- package/lib/modules/Order/utils.d.ts +5 -2
- package/lib/modules/Order/utils.js +1 -2
- package/lib/solution/BaseSales/index.js +6 -0
- package/lib/solution/BookingTicket/index.js +9 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.js +13 -5
- package/package.json +1 -1
|
@@ -823,11 +823,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
823
823
|
}, {
|
|
824
824
|
key: "restoreOrder",
|
|
825
825
|
value: function restoreOrder() {
|
|
826
|
+
var _this$store$discount9, _this$store$discount10;
|
|
826
827
|
var freshTempOrder = this.createDefaultTempOrderInstance();
|
|
827
828
|
this.ensureExternalSaleNumber(freshTempOrder);
|
|
828
829
|
this.store.tempOrder = freshTempOrder;
|
|
829
830
|
this.store.summary = createEmptySummary();
|
|
830
831
|
this.store.lastOrderInfo = undefined;
|
|
832
|
+
void ((_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.setOriginalDiscountList([]));
|
|
833
|
+
void ((_this$store$discount10 = this.store.discount) === null || _this$store$discount10 === void 0 ? void 0 : _this$store$discount10.setDiscountList([]));
|
|
831
834
|
this.persistTempOrder();
|
|
832
835
|
return freshTempOrder;
|
|
833
836
|
}
|
|
@@ -491,11 +491,6 @@ export interface OrderModuleAPI {
|
|
|
491
491
|
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
|
|
492
492
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
493
493
|
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
494
|
-
/**
|
|
495
|
-
* 仅清空购物车行:products / bookings / discount_list(保留客户、备注、支付等其它 tempOrder 字段)。
|
|
496
|
-
* 内部会 applyDiscount + recalculateSummary + persist。
|
|
497
|
-
*/
|
|
498
|
-
clearOrderCartLines: () => Promise<OrderTempOrder>;
|
|
499
494
|
persistTempOrder: () => void;
|
|
500
495
|
submitTempOrder: <T = any>(params?: {
|
|
501
496
|
cacheId?: string;
|
|
@@ -68,8 +68,11 @@ export declare function sumOptionUnitPrice(options?: Array<{
|
|
|
68
68
|
/** Rules calcDiscount 用手动价标记;undefined 表示交给 Rules 用 total/origin_total 推断 */
|
|
69
69
|
export declare function resolveRulesManualDiscountFlag(metadata: Record<string, any> | null | undefined): boolean | undefined;
|
|
70
70
|
/**
|
|
71
|
-
* 手动改价(price_override)时行级 original_price
|
|
72
|
-
*
|
|
71
|
+
* 手动改价(price_override)时行级 original_price(composite 单价):
|
|
72
|
+
* 购物车划线价应对齐 metadata.origin._extend.origin_total(改价前单价 composite,如 40),
|
|
73
|
+
* 而非 bundle 子项 catalog 原价合成的 composedOriginalPrice(如 30)。
|
|
74
|
+
*
|
|
75
|
+
* origin_total 与 SkuDetailModal / cacheItem._extend 一致,为单价语义,不再除以 num。
|
|
73
76
|
*/
|
|
74
77
|
export declare function resolveManualOverrideLineOriginalPrice(params: {
|
|
75
78
|
num?: number;
|
|
@@ -128,8 +128,11 @@ export function resolveRulesManualDiscountFlag(metadata) {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* 手动改价(price_override)时行级 original_price
|
|
132
|
-
*
|
|
131
|
+
* 手动改价(price_override)时行级 original_price(composite 单价):
|
|
132
|
+
* 购物车划线价应对齐 metadata.origin._extend.origin_total(改价前单价 composite,如 40),
|
|
133
|
+
* 而非 bundle 子项 catalog 原价合成的 composedOriginalPrice(如 30)。
|
|
134
|
+
*
|
|
135
|
+
* origin_total 与 SkuDetailModal / cacheItem._extend 一致,为单价语义,不再除以 num。
|
|
133
136
|
*/
|
|
134
137
|
export function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOriginal) {
|
|
135
138
|
var _metadata$origin;
|
|
@@ -146,8 +149,7 @@ export function resolveManualOverrideLineOriginalPrice(params, fallbackComposite
|
|
|
146
149
|
if (!Number.isFinite(parsed)) {
|
|
147
150
|
return fallbackCompositeOriginal;
|
|
148
151
|
}
|
|
149
|
-
|
|
150
|
-
return new Decimal(parsed).dividedBy(num).toDecimalPlaces(2).toFixed(2);
|
|
152
|
+
return new Decimal(parsed).toDecimalPlaces(2).toFixed(2);
|
|
151
153
|
}
|
|
152
154
|
export function createDefaultOrderRulesHooks() {
|
|
153
155
|
var toUnitPriceString = function toUnitPriceString(totalLike, num) {
|
|
@@ -1041,11 +1041,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1041
1041
|
});
|
|
1042
1042
|
case 28:
|
|
1043
1043
|
this.store.order.persistTempOrder();
|
|
1044
|
+
_context11.next = 31;
|
|
1045
|
+
return this.effectsEmit('onDiscountApplied', {
|
|
1046
|
+
productList: tempOrder.products || [],
|
|
1047
|
+
discountList: nextDiscountList,
|
|
1048
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
1049
|
+
tempOrder: tempOrder
|
|
1050
|
+
});
|
|
1051
|
+
case 31:
|
|
1044
1052
|
return _context11.abrupt("return", {
|
|
1045
1053
|
productList: tempOrder.products || [],
|
|
1046
1054
|
discountList: nextDiscountList
|
|
1047
1055
|
});
|
|
1048
|
-
case
|
|
1056
|
+
case 32:
|
|
1049
1057
|
case "end":
|
|
1050
1058
|
return _context11.stop();
|
|
1051
1059
|
}
|
|
@@ -723,7 +723,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
723
723
|
}, {
|
|
724
724
|
key: "clearOrderCustomer",
|
|
725
725
|
value: function clearOrderCustomer() {
|
|
726
|
+
var _discountModule$setOr,
|
|
727
|
+
_discountModule$setDi,
|
|
728
|
+
_this2 = this;
|
|
726
729
|
this.store.order.clearOrderCustomer();
|
|
730
|
+
var orderStore = this.store.order.store || {};
|
|
731
|
+
var discountModule = orderStore.discount;
|
|
732
|
+
void (discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, []));
|
|
733
|
+
void (discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []));
|
|
734
|
+
this.store.order.applyDiscount();
|
|
735
|
+
void this.store.order.recalculateSummary({
|
|
736
|
+
createIfMissing: true
|
|
737
|
+
}).then(function () {
|
|
738
|
+
return _this2.store.order.persistTempOrder();
|
|
739
|
+
}).catch(function (error) {
|
|
740
|
+
console.error('Failed to recalculate summary after clearing customer:', error);
|
|
741
|
+
});
|
|
727
742
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
|
|
728
743
|
}
|
|
729
744
|
|
|
@@ -776,7 +791,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
776
791
|
}, {
|
|
777
792
|
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
778
793
|
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
779
|
-
var
|
|
794
|
+
var _this3 = this;
|
|
780
795
|
if (!customerId || customerId === 1) return;
|
|
781
796
|
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
782
797
|
return;
|
|
@@ -796,7 +811,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
796
811
|
return undefined;
|
|
797
812
|
});
|
|
798
813
|
case 3:
|
|
799
|
-
currentCustomer =
|
|
814
|
+
currentCustomer = _this3.store.order.getOrderCustomer();
|
|
800
815
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
801
816
|
_context12.next = 6;
|
|
802
817
|
break;
|
|
@@ -804,7 +819,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
804
819
|
return _context12.abrupt("return");
|
|
805
820
|
case 6:
|
|
806
821
|
_context12.next = 8;
|
|
807
|
-
return
|
|
822
|
+
return _this3.loadDiscountConfig({
|
|
808
823
|
customerId: customerId
|
|
809
824
|
});
|
|
810
825
|
case 8:
|
|
@@ -818,9 +833,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
818
833
|
refreshTask.catch(function (error) {
|
|
819
834
|
console.error('Failed to load discount config after customer change:', error);
|
|
820
835
|
}).finally(function () {
|
|
821
|
-
if (
|
|
822
|
-
|
|
823
|
-
|
|
836
|
+
if (_this3.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
837
|
+
_this3.orderCustomerDiscountRefreshInFlight = null;
|
|
838
|
+
_this3.orderCustomerDiscountRefreshCustomerId = null;
|
|
824
839
|
});
|
|
825
840
|
}
|
|
826
841
|
|
|
@@ -1005,9 +1020,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1005
1020
|
}, {
|
|
1006
1021
|
key: "scanGlobalListener",
|
|
1007
1022
|
value: function scanGlobalListener(callback) {
|
|
1008
|
-
var
|
|
1023
|
+
var _this4 = this;
|
|
1009
1024
|
var localSearch = function localSearch(v) {
|
|
1010
|
-
return
|
|
1025
|
+
return _this4.store.products.findProductsByCodeOrBarcode(v);
|
|
1011
1026
|
};
|
|
1012
1027
|
var scanCallback = handleGlobalScan(this.request, localSearch);
|
|
1013
1028
|
var safeCallback = function safeCallback(d) {
|
|
@@ -89,8 +89,10 @@ export declare function buildRequiresDetailPayload(item: any, ctx?: AddProductDe
|
|
|
89
89
|
*/
|
|
90
90
|
export declare function buildCacheItemFromCartDetail(item: any, ctx?: AddProductDecideContext): any;
|
|
91
91
|
/**
|
|
92
|
-
* 用 Info2 callback 的 (e, extension_type, detail)
|
|
93
|
-
*
|
|
92
|
+
* 用 Info2 callback 的 (e, extension_type, detail) 拼装 cacheItem。
|
|
93
|
+
*
|
|
94
|
+
* 保留 detail._extend 中的 pricing / note(规格弹窗改价、备注等),
|
|
95
|
+
* 再叠加 session 时间、ctx.quantity 等运行态字段;other 以 callback `e` 为准。
|
|
94
96
|
*/
|
|
95
97
|
export declare function buildCacheItemFromDetail(item: any, detailResult: {
|
|
96
98
|
e: any;
|
|
@@ -239,34 +239,44 @@ export function buildCacheItemFromCartDetail(item, ctx) {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
|
-
* 用 Info2 callback 的 (e, extension_type, detail)
|
|
243
|
-
*
|
|
242
|
+
* 用 Info2 callback 的 (e, extension_type, detail) 拼装 cacheItem。
|
|
243
|
+
*
|
|
244
|
+
* 保留 detail._extend 中的 pricing / note(规格弹窗改价、备注等),
|
|
245
|
+
* 再叠加 session 时间、ctx.quantity 等运行态字段;other 以 callback `e` 为准。
|
|
244
246
|
*/
|
|
245
247
|
export function buildCacheItemFromDetail(item, detailResult, ctx) {
|
|
246
|
-
var _detailResult$e, _currentItem$id, _detail$extension_typ, _ref2, _ctx$quantity2, _detailResult$e2, _detailResult$e3;
|
|
248
|
+
var _detailResult$e, _currentItem$id, _detail$extension_typ, _ref2, _ref3, _ctx$quantity2, _detailResult$e2, _ref4, _detailExtend$price, _currentItem$title, _detailExtend$note, _detailResult$e3;
|
|
247
249
|
var _currentItem = detailResult.detail || item;
|
|
248
250
|
var _detail = _currentItem;
|
|
251
|
+
var detailExtend = (_detail === null || _detail === void 0 ? void 0 : _detail._extend) || {};
|
|
249
252
|
var other = JSON.parse(JSON.stringify(detailResult.e || {}));
|
|
250
253
|
other.session = (_detailResult$e = detailResult.e) === null || _detailResult$e === void 0 ? void 0 : _detailResult$e.session;
|
|
251
254
|
var resolvedId = (_currentItem$id = _currentItem.id) !== null && _currentItem$id !== void 0 ? _currentItem$id : _currentItem.product_id;
|
|
252
255
|
var mergedItem = _objectSpread(_objectSpread(_objectSpread({}, item), _detail), {}, {
|
|
253
256
|
extension_type: (_detail$extension_typ = _detail.extension_type) !== null && _detail$extension_typ !== void 0 ? _detail$extension_typ : item.extension_type
|
|
254
257
|
});
|
|
255
|
-
var
|
|
256
|
-
start_date: (ctx === null || ctx === void 0 ? void 0 : ctx.date) || undefined,
|
|
257
|
-
quantity: (_ref2 = (_ctx$quantity2 = ctx === null || ctx === void 0 ? void 0 : ctx.quantity) !== null && _ctx$quantity2 !== void 0 ? _ctx$quantity2 : (_detailResult$e2 = detailResult.e) === null || _detailResult$e2 === void 0 ? void 0 : _detailResult$e2.quantity) !== null && _ref2 !== void 0 ? _ref2 : 1,
|
|
258
|
-
price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
|
|
259
|
-
product_name: _currentItem.title,
|
|
258
|
+
var runtimeExtend = applySessionTimesToExtend(mergedItem, {
|
|
259
|
+
start_date: (ctx === null || ctx === void 0 ? void 0 : ctx.date) || detailExtend.start_date || undefined,
|
|
260
|
+
quantity: (_ref2 = (_ref3 = (_ctx$quantity2 = ctx === null || ctx === void 0 ? void 0 : ctx.quantity) !== null && _ctx$quantity2 !== void 0 ? _ctx$quantity2 : (_detailResult$e2 = detailResult.e) === null || _detailResult$e2 === void 0 ? void 0 : _detailResult$e2.quantity) !== null && _ref3 !== void 0 ? _ref3 : detailExtend.quantity) !== null && _ref2 !== void 0 ? _ref2 : 1,
|
|
261
|
+
price: (_ref4 = (_detailExtend$price = detailExtend.price) !== null && _detailExtend$price !== void 0 ? _detailExtend$price : _detail === null || _detail === void 0 ? void 0 : _detail.price) !== null && _ref4 !== void 0 ? _ref4 : item === null || item === void 0 ? void 0 : item.price,
|
|
262
|
+
product_name: (_currentItem$title = _currentItem.title) !== null && _currentItem$title !== void 0 ? _currentItem$title : detailExtend.product_name,
|
|
260
263
|
other: other,
|
|
261
264
|
isNormalProduct: !isBookingProduct(mergedItem)
|
|
262
265
|
}, {
|
|
263
266
|
date: ctx === null || ctx === void 0 ? void 0 : ctx.date
|
|
264
267
|
});
|
|
265
|
-
|
|
268
|
+
var extend = _objectSpread(_objectSpread(_objectSpread({}, detailExtend), runtimeExtend), {}, {
|
|
269
|
+
other: other
|
|
270
|
+
});
|
|
271
|
+
var note = (_detailExtend$note = detailExtend.note) !== null && _detailExtend$note !== void 0 ? _detailExtend$note : _detail === null || _detail === void 0 ? void 0 : _detail.note;
|
|
272
|
+
return _objectSpread(_objectSpread(_objectSpread({}, _detail), {}, {
|
|
266
273
|
id: resolvedId,
|
|
267
274
|
product_id: resolvedId,
|
|
268
275
|
extension_type: mergedItem.extension_type,
|
|
269
|
-
_key: (_detailResult$e3 = detailResult.e) === null || _detailResult$e3 === void 0 ? void 0 : _detailResult$e3.key
|
|
276
|
+
_key: (_detailResult$e3 = detailResult.e) === null || _detailResult$e3 === void 0 ? void 0 : _detailResult$e3.key
|
|
277
|
+
}, note != null && note !== '' ? {
|
|
278
|
+
note: String(note)
|
|
279
|
+
} : {}), {}, {
|
|
270
280
|
_extend: extend,
|
|
271
281
|
new: 1
|
|
272
282
|
});
|
|
@@ -307,7 +317,7 @@ export function transformDetailToProductAndBooking(cacheItem, ctx) {
|
|
|
307
317
|
* 把 cacheItem._extend.other 中的字段 + 顶层运行态拼成 `BaseProductDetailPayload`。
|
|
308
318
|
*/
|
|
309
319
|
function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
310
|
-
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id,
|
|
320
|
+
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2;
|
|
311
321
|
var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.other) || {};
|
|
312
322
|
var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
|
|
313
323
|
var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
|
|
@@ -315,7 +325,7 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
|
315
325
|
return {
|
|
316
326
|
id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
|
|
317
327
|
product_id: resolvedPid,
|
|
318
|
-
variant_id: (
|
|
328
|
+
variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
|
|
319
329
|
quantity: quantity,
|
|
320
330
|
option: (other === null || other === void 0 ? void 0 : other.option) || [],
|
|
321
331
|
bundle: (other === null || other === void 0 ? void 0 : other.bundle) || (extend === null || extend === void 0 || (_extend$skuValue = extend.skuValue) === null || _extend$skuValue === void 0 ? void 0 : _extend$skuValue.bundle) || (extend === null || extend === void 0 || (_extend$_skuValue = extend._skuValue) === null || _extend$_skuValue === void 0 ? void 0 : _extend$_skuValue.bundle) || [],
|
|
@@ -564,11 +564,14 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
564
564
|
return newOrder;
|
|
565
565
|
}
|
|
566
566
|
restoreOrder() {
|
|
567
|
+
var _a, _b;
|
|
567
568
|
const freshTempOrder = this.createDefaultTempOrderInstance();
|
|
568
569
|
this.ensureExternalSaleNumber(freshTempOrder);
|
|
569
570
|
this.store.tempOrder = freshTempOrder;
|
|
570
571
|
this.store.summary = (0, import_utils.createEmptySummary)();
|
|
571
572
|
this.store.lastOrderInfo = void 0;
|
|
573
|
+
void ((_a = this.store.discount) == null ? void 0 : _a.setOriginalDiscountList([]));
|
|
574
|
+
void ((_b = this.store.discount) == null ? void 0 : _b.setDiscountList([]));
|
|
572
575
|
this.persistTempOrder();
|
|
573
576
|
return freshTempOrder;
|
|
574
577
|
}
|
|
@@ -491,11 +491,6 @@ export interface OrderModuleAPI {
|
|
|
491
491
|
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
|
|
492
492
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
493
493
|
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
494
|
-
/**
|
|
495
|
-
* 仅清空购物车行:products / bookings / discount_list(保留客户、备注、支付等其它 tempOrder 字段)。
|
|
496
|
-
* 内部会 applyDiscount + recalculateSummary + persist。
|
|
497
|
-
*/
|
|
498
|
-
clearOrderCartLines: () => Promise<OrderTempOrder>;
|
|
499
494
|
persistTempOrder: () => void;
|
|
500
495
|
submitTempOrder: <T = any>(params?: {
|
|
501
496
|
cacheId?: string;
|
|
@@ -68,8 +68,11 @@ export declare function sumOptionUnitPrice(options?: Array<{
|
|
|
68
68
|
/** Rules calcDiscount 用手动价标记;undefined 表示交给 Rules 用 total/origin_total 推断 */
|
|
69
69
|
export declare function resolveRulesManualDiscountFlag(metadata: Record<string, any> | null | undefined): boolean | undefined;
|
|
70
70
|
/**
|
|
71
|
-
* 手动改价(price_override)时行级 original_price
|
|
72
|
-
*
|
|
71
|
+
* 手动改价(price_override)时行级 original_price(composite 单价):
|
|
72
|
+
* 购物车划线价应对齐 metadata.origin._extend.origin_total(改价前单价 composite,如 40),
|
|
73
|
+
* 而非 bundle 子项 catalog 原价合成的 composedOriginalPrice(如 30)。
|
|
74
|
+
*
|
|
75
|
+
* origin_total 与 SkuDetailModal / cacheItem._extend 一致,为单价语义,不再除以 num。
|
|
73
76
|
*/
|
|
74
77
|
export declare function resolveManualOverrideLineOriginalPrice(params: {
|
|
75
78
|
num?: number;
|
|
@@ -109,8 +109,7 @@ function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOrigina
|
|
|
109
109
|
if (!Number.isFinite(parsed)) {
|
|
110
110
|
return fallbackCompositeOriginal;
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
return new import_decimal.default(parsed).dividedBy(num).toDecimalPlaces(2).toFixed(2);
|
|
112
|
+
return new import_decimal.default(parsed).toDecimalPlaces(2).toFixed(2);
|
|
114
113
|
}
|
|
115
114
|
function createDefaultOrderRulesHooks() {
|
|
116
115
|
const toUnitPriceString = (totalLike, num) => {
|
|
@@ -610,6 +610,12 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
this.store.order.persistTempOrder();
|
|
613
|
+
await this.effectsEmit("onDiscountApplied", {
|
|
614
|
+
productList: tempOrder.products || [],
|
|
615
|
+
discountList: nextDiscountList,
|
|
616
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
617
|
+
tempOrder
|
|
618
|
+
});
|
|
613
619
|
return {
|
|
614
620
|
productList: tempOrder.products || [],
|
|
615
621
|
discountList: nextDiscountList
|
|
@@ -431,7 +431,16 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
431
431
|
* 清空下单客户(协议字段 + snapshot)。
|
|
432
432
|
*/
|
|
433
433
|
clearOrderCustomer() {
|
|
434
|
+
var _a, _b;
|
|
434
435
|
this.store.order.clearOrderCustomer();
|
|
436
|
+
const orderStore = this.store.order.store || {};
|
|
437
|
+
const discountModule = orderStore.discount;
|
|
438
|
+
void ((_a = discountModule == null ? void 0 : discountModule.setOriginalDiscountList) == null ? void 0 : _a.call(discountModule, []));
|
|
439
|
+
void ((_b = discountModule == null ? void 0 : discountModule.setDiscountList) == null ? void 0 : _b.call(discountModule, []));
|
|
440
|
+
this.store.order.applyDiscount();
|
|
441
|
+
void this.store.order.recalculateSummary({ createIfMissing: true }).then(() => this.store.order.persistTempOrder()).catch((error) => {
|
|
442
|
+
console.error("Failed to recalculate summary after clearing customer:", error);
|
|
443
|
+
});
|
|
435
444
|
this.core.effects.emit(`${this.name}:onOrderCustomerChange`, null);
|
|
436
445
|
}
|
|
437
446
|
/**
|
|
@@ -89,8 +89,10 @@ export declare function buildRequiresDetailPayload(item: any, ctx?: AddProductDe
|
|
|
89
89
|
*/
|
|
90
90
|
export declare function buildCacheItemFromCartDetail(item: any, ctx?: AddProductDecideContext): any;
|
|
91
91
|
/**
|
|
92
|
-
* 用 Info2 callback 的 (e, extension_type, detail)
|
|
93
|
-
*
|
|
92
|
+
* 用 Info2 callback 的 (e, extension_type, detail) 拼装 cacheItem。
|
|
93
|
+
*
|
|
94
|
+
* 保留 detail._extend 中的 pricing / note(规格弹窗改价、备注等),
|
|
95
|
+
* 再叠加 session 时间、ctx.quantity 等运行态字段;other 以 callback `e` 为准。
|
|
94
96
|
*/
|
|
95
97
|
export declare function buildCacheItemFromDetail(item: any, detailResult: {
|
|
96
98
|
e: any;
|
|
@@ -222,28 +222,36 @@ function buildCacheItemFromDetail(item, detailResult, ctx) {
|
|
|
222
222
|
var _a, _b, _c;
|
|
223
223
|
const _currentItem = detailResult.detail || item;
|
|
224
224
|
const _detail = _currentItem;
|
|
225
|
+
const detailExtend = (_detail == null ? void 0 : _detail._extend) || {};
|
|
225
226
|
const other = JSON.parse(JSON.stringify(detailResult.e || {}));
|
|
226
227
|
other.session = (_a = detailResult.e) == null ? void 0 : _a.session;
|
|
227
228
|
const resolvedId = _currentItem.id ?? _currentItem.product_id;
|
|
228
229
|
const mergedItem = { ...item, ..._detail, extension_type: _detail.extension_type ?? item.extension_type };
|
|
229
|
-
const
|
|
230
|
+
const runtimeExtend = (0, import_BookingContext.applySessionTimesToExtend)(
|
|
230
231
|
mergedItem,
|
|
231
232
|
{
|
|
232
|
-
start_date: (ctx == null ? void 0 : ctx.date) || void 0,
|
|
233
|
-
quantity: (ctx == null ? void 0 : ctx.quantity) ?? ((_b = detailResult.e) == null ? void 0 : _b.quantity) ?? 1,
|
|
234
|
-
price: _detail == null ? void 0 : _detail.price,
|
|
235
|
-
product_name: _currentItem.title,
|
|
233
|
+
start_date: (ctx == null ? void 0 : ctx.date) || detailExtend.start_date || void 0,
|
|
234
|
+
quantity: (ctx == null ? void 0 : ctx.quantity) ?? ((_b = detailResult.e) == null ? void 0 : _b.quantity) ?? detailExtend.quantity ?? 1,
|
|
235
|
+
price: detailExtend.price ?? (_detail == null ? void 0 : _detail.price) ?? (item == null ? void 0 : item.price),
|
|
236
|
+
product_name: _currentItem.title ?? detailExtend.product_name,
|
|
236
237
|
other,
|
|
237
238
|
isNormalProduct: !(0, import_BookingContext.isBookingProduct)(mergedItem)
|
|
238
239
|
},
|
|
239
240
|
{ date: ctx == null ? void 0 : ctx.date }
|
|
240
241
|
);
|
|
242
|
+
const extend = {
|
|
243
|
+
...detailExtend,
|
|
244
|
+
...runtimeExtend,
|
|
245
|
+
other
|
|
246
|
+
};
|
|
247
|
+
const note = detailExtend.note ?? (_detail == null ? void 0 : _detail.note);
|
|
241
248
|
return {
|
|
242
249
|
..._detail,
|
|
243
250
|
id: resolvedId,
|
|
244
251
|
product_id: resolvedId,
|
|
245
252
|
extension_type: mergedItem.extension_type,
|
|
246
253
|
_key: (_c = detailResult.e) == null ? void 0 : _c.key,
|
|
254
|
+
...note != null && note !== "" ? { note: String(note) } : {},
|
|
247
255
|
_extend: extend,
|
|
248
256
|
new: 1
|
|
249
257
|
};
|