@pisell/pisellos 2.2.170 → 2.2.171
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/index.js +0 -9
- package/dist/modules/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +15 -27
- package/dist/modules/Order/index.js +322 -695
- package/dist/modules/Order/types.d.ts +14 -49
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +0 -17
- package/dist/modules/Order/utils.js +26 -97
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/solution/BaseSales/index.d.ts +7 -46
- package/dist/solution/BaseSales/index.js +315 -1009
- package/dist/solution/BaseSales/types.d.ts +1 -53
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -65
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -768
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +15 -27
- package/lib/modules/Order/index.js +84 -336
- package/lib/modules/Order/types.d.ts +14 -49
- package/lib/modules/Order/utils.d.ts +0 -17
- package/lib/modules/Order/utils.js +18 -105
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/solution/BaseSales/index.d.ts +7 -46
- package/lib/solution/BaseSales/index.js +20 -434
- package/lib/solution/BaseSales/types.d.ts +1 -53
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +11 -70
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -341
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -159
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -201
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OrderModule, ProductList,
|
|
1
|
+
import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLoggerModule as BaseSalesLoggerModule, ScheduleModule } from '../../modules';
|
|
2
2
|
import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderConfig as BaseSalesLoggerProviderConfig, ScanOrderLoggerProviderType as BaseSalesLoggerProviderType } from '../../modules/ScanOrderLogger/types';
|
|
3
3
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
4
4
|
/**
|
|
@@ -11,8 +11,6 @@ export declare const BaseSalesHookNames: {
|
|
|
11
11
|
readonly onRetryInit: "onRetryInit";
|
|
12
12
|
readonly onRefresh: "onRefresh";
|
|
13
13
|
readonly onCartValidationChanged: "onCartValidationChanged";
|
|
14
|
-
readonly onPaymentSyncStart: "onPaymentSyncStart";
|
|
15
|
-
readonly onPaymentSyncEnd: "onPaymentSyncEnd";
|
|
16
14
|
};
|
|
17
15
|
export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSalesHookNames];
|
|
18
16
|
export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
|
|
@@ -44,9 +42,6 @@ export interface BaseSalesOrderProductIdentity {
|
|
|
44
42
|
product_option_item?: any[];
|
|
45
43
|
product_bundle?: any[];
|
|
46
44
|
}
|
|
47
|
-
export interface BaseSalesUpdateOrderProductQuantityParams extends BaseSalesOrderProductIdentity {
|
|
48
|
-
num: number;
|
|
49
|
-
}
|
|
50
45
|
export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
|
|
51
46
|
order_detail_id: number | null;
|
|
52
47
|
num: number;
|
|
@@ -208,52 +203,6 @@ export interface BaseSalesSubmitPayload extends Omit<BaseSalesTempOrder, 'platfo
|
|
|
208
203
|
}>;
|
|
209
204
|
products: BaseSalesSubmitProduct[];
|
|
210
205
|
}
|
|
211
|
-
export interface BaseSalesQuotationDurationConfig {
|
|
212
|
-
type: string;
|
|
213
|
-
value: number;
|
|
214
|
-
flexible_config?: {
|
|
215
|
-
is_enable_minimum_duration?: 0 | 1;
|
|
216
|
-
warning_threshold?: number;
|
|
217
|
-
block_threshold?: number;
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
export interface BaseSalesCalculateProductBookingPriceParams {
|
|
221
|
-
product: Record<string, any>;
|
|
222
|
-
booking?: {
|
|
223
|
-
start_date?: string;
|
|
224
|
-
start_time?: string;
|
|
225
|
-
end_date?: string;
|
|
226
|
-
end_time?: string;
|
|
227
|
-
[key: string]: any;
|
|
228
|
-
};
|
|
229
|
-
duration?: BaseSalesQuotationDurationConfig;
|
|
230
|
-
customer_id?: number | string;
|
|
231
|
-
fallback_price?: number | string;
|
|
232
|
-
datetime?: string;
|
|
233
|
-
channel?: string;
|
|
234
|
-
}
|
|
235
|
-
export type BaseSalesProductBookingPriceSegmentSource = 'quotation' | 'fallback';
|
|
236
|
-
export interface BaseSalesProductBookingPriceSegment {
|
|
237
|
-
start_datetime: string;
|
|
238
|
-
end_datetime?: string;
|
|
239
|
-
time_point: string;
|
|
240
|
-
unit_price: string;
|
|
241
|
-
quantity: number;
|
|
242
|
-
total_price: string;
|
|
243
|
-
quotation_shelf_id: number;
|
|
244
|
-
source: BaseSalesProductBookingPriceSegmentSource;
|
|
245
|
-
}
|
|
246
|
-
export interface BaseSalesProductBookingPriceResult {
|
|
247
|
-
product_id: number | null;
|
|
248
|
-
product_variant_id: number;
|
|
249
|
-
customer_id?: number | string;
|
|
250
|
-
unit_price: string;
|
|
251
|
-
total_price: string;
|
|
252
|
-
quantity: number;
|
|
253
|
-
duration?: BaseSalesQuotationDurationConfig;
|
|
254
|
-
quotation_shelf_id: number;
|
|
255
|
-
segments: BaseSalesProductBookingPriceSegment[];
|
|
256
|
-
}
|
|
257
206
|
export type BaseSalesAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
258
207
|
export interface BaseSalesTableFormRecord {
|
|
259
208
|
policy?: string | null;
|
|
@@ -332,7 +281,6 @@ export interface BaseSalesState {
|
|
|
332
281
|
error: string | null;
|
|
333
282
|
products?: ProductList;
|
|
334
283
|
order?: OrderModule;
|
|
335
|
-
quotation?: QuotationModule;
|
|
336
284
|
salesSummary?: SalesSummaryModule;
|
|
337
285
|
baseSalesLogger?: BaseSalesLoggerModule;
|
|
338
286
|
schedule?: ScheduleModule;
|
|
@@ -7,9 +7,7 @@ export var BaseSalesHookNames = {
|
|
|
7
7
|
onDestroy: 'onDestroy',
|
|
8
8
|
onRetryInit: 'onRetryInit',
|
|
9
9
|
onRefresh: 'onRefresh',
|
|
10
|
-
onCartValidationChanged: 'onCartValidationChanged'
|
|
11
|
-
onPaymentSyncStart: 'onPaymentSyncStart',
|
|
12
|
-
onPaymentSyncEnd: 'onPaymentSyncEnd'
|
|
10
|
+
onCartValidationChanged: 'onCartValidationChanged'
|
|
13
11
|
};
|
|
14
12
|
export function createBaseSalesHook(moduleName, hookName) {
|
|
15
13
|
return "".concat(moduleName, ":").concat(hookName);
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
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; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
|
|
8
7
|
function toNumber(value) {
|
|
9
8
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
10
9
|
var parsedValue = Number(value);
|
|
@@ -44,19 +43,9 @@ function normalizeOptionItems(optionItems) {
|
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
45
|
function normalizeBundleItems(bundleItems) {
|
|
47
|
-
var preferPriceField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
48
46
|
if (!Array.isArray(bundleItems)) return [];
|
|
49
47
|
return bundleItems.map(function (bundleItem) {
|
|
50
|
-
var _ref2, _ref3, _ref4, _bundleItem$price, _ref5, _ref6, _ref7, _bundleItem$bundle_se, _bundleItem$num, _bundleItem$quantity, _bundleItem$price2, _ref8, _ref9, _bundleItem$original_;
|
|
51
|
-
var unitSelling = preferPriceField ? (_ref2 = (_ref3 = (_ref4 = (_bundleItem$price = bundleItem.price) !== null && _bundleItem$price !== void 0 ? _bundleItem$price : bundleItem.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : bundleItem.custom_price) !== null && _ref3 !== void 0 ? _ref3 : bundleItem.product_price) !== null && _ref2 !== void 0 ? _ref2 : '0' : (_ref5 = (_ref6 = (_ref7 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref7 !== void 0 ? _ref7 : bundleItem.custom_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.product_price) !== null && _ref5 !== void 0 ? _ref5 : '0';
|
|
52
|
-
var unitStr = toPriceString(unitSelling, '0.00');
|
|
53
|
-
var num = toSafePositiveInt((_bundleItem$num = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity, 1);
|
|
54
48
|
return _objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
55
|
-
num: num,
|
|
56
|
-
quantity: (_bundleItem$quantity = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity) !== null && _bundleItem$quantity !== void 0 ? _bundleItem$quantity : num,
|
|
57
|
-
price: (_bundleItem$price2 = bundleItem.price) !== null && _bundleItem$price2 !== void 0 ? _bundleItem$price2 : unitStr,
|
|
58
|
-
bundle_selling_price: unitStr,
|
|
59
|
-
original_price: (_ref8 = (_ref9 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref9 !== void 0 ? _ref9 : bundleItem.price) !== null && _ref8 !== void 0 ? _ref8 : unitStr,
|
|
60
49
|
option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option)
|
|
61
50
|
});
|
|
62
51
|
});
|
|
@@ -75,53 +64,23 @@ function findVariantById(origin, variantId) {
|
|
|
75
64
|
* 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
|
|
76
65
|
*/
|
|
77
66
|
export function transformBaseProductToOrderProduct(params) {
|
|
78
|
-
var
|
|
67
|
+
var _ref2, _ref3, _ref4, _payload$product_id, _ref5, _ref6, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref7, _findVariantById, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _payload$price, _ref15, _payload$option, _payload$bundle, _payload$unique_ident, _payload$quantity, _ref16, _ref17, _payload$tax_fee, _ref18, _ref19, _payload$is_charge_ta;
|
|
79
68
|
var payload = params.payload,
|
|
80
69
|
_params$fallbackProdu = params.fallbackProductId,
|
|
81
70
|
fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
|
|
82
71
|
if (!payload || _typeof(payload) !== 'object') return null;
|
|
83
72
|
var sourceProduct = params.sourceProduct || params.sourceItem || {};
|
|
84
|
-
var productId = toProductId((
|
|
73
|
+
var productId = toProductId((_ref2 = (_ref3 = (_ref4 = (_payload$product_id = payload.product_id) !== null && _payload$product_id !== void 0 ? _payload$product_id : payload.id) !== null && _ref4 !== void 0 ? _ref4 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_id) !== null && _ref3 !== void 0 ? _ref3 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id) !== null && _ref2 !== void 0 ? _ref2 : fallbackProductId);
|
|
85
74
|
if (productId === null) return null;
|
|
86
|
-
var productVariantId = toNumber((
|
|
75
|
+
var productVariantId = toNumber((_ref5 = (_ref6 = (_payload$product_vari = payload.product_variant_id) !== null && _payload$product_vari !== void 0 ? _payload$product_vari : payload.variant_id) !== null && _ref6 !== void 0 ? _ref6 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_variant_id) !== null && _ref5 !== void 0 ? _ref5 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.variant_id, 0);
|
|
87
76
|
var callbackOrigin = payload.origin || ((_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.sourceProduct) || ((_payload$_origin2 = payload._origin) === null || _payload$_origin2 === void 0 ? void 0 : _payload$_origin2.sourceItem) || payload._origin || {};
|
|
88
77
|
var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
|
|
89
|
-
var matchedVariant = (
|
|
90
|
-
var sourceProductPrice = toPriceString((
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var productOptionItem = normalizeOptionItems((_ref24 = (_payload$option = payload.option) !== null && _payload$option !== void 0 ? _payload$option : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item);
|
|
94
|
-
var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride);
|
|
78
|
+
var matchedVariant = (_ref7 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref7 !== void 0 ? _ref7 : findVariantById(origin, productVariantId);
|
|
79
|
+
var sourceProductPrice = toPriceString((_ref8 = (_ref9 = (_ref10 = (_ref11 = (_ref12 = (_ref13 = (_ref14 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref14 !== void 0 ? _ref14 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _ref13 !== void 0 ? _ref13 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref12 !== void 0 ? _ref12 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref11 !== void 0 ? _ref11 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref10 !== void 0 ? _ref10 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref9 !== void 0 ? _ref9 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref8 !== void 0 ? _ref8 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price, '0.00');
|
|
80
|
+
var productOptionItem = normalizeOptionItems((_ref15 = (_payload$option = payload.option) !== null && _payload$option !== void 0 ? _payload$option : payload.options) !== null && _ref15 !== void 0 ? _ref15 : payload.product_option_item);
|
|
81
|
+
var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle);
|
|
95
82
|
var uniqueIdentificationNumber = (_payload$unique_ident = payload.unique_identification_number) !== null && _payload$unique_ident !== void 0 ? _payload$unique_ident : payload.unique;
|
|
96
|
-
var
|
|
97
|
-
var originTotal = resolveManualDiscountOriginTotal({
|
|
98
|
-
originTotal: payload.origin_total,
|
|
99
|
-
extendOriginTotal: (_payload$_extend2 = payload._extend) === null || _payload$_extend2 === void 0 ? void 0 : _payload$_extend2.origin_total,
|
|
100
|
-
originExtendOriginTotal: origin === null || origin === void 0 || (_extend = origin._extend) === null || _extend === void 0 ? void 0 : _extend.origin_total,
|
|
101
|
-
sourceExtendOriginTotal: sourceProduct === null || sourceProduct === void 0 || (_extend2 = sourceProduct._extend) === null || _extend2 === void 0 ? void 0 : _extend2.origin_total,
|
|
102
|
-
catalogUnitPrice: (_ref25 = (_ref26 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref26 !== void 0 ? _ref26 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref25 !== void 0 ? _ref25 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
|
|
103
|
-
quantity: resolvedQuantity
|
|
104
|
-
});
|
|
105
|
-
var sellingTotal = Number((_ref27 = (_ref28 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref28 !== void 0 ? _ref28 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total) !== null && _ref27 !== void 0 ? _ref27 : lineCompositeTotal);
|
|
106
|
-
var discountReason = resolveManualDiscountReasonFromSources({
|
|
107
|
-
discountReason: payload.discount_reason,
|
|
108
|
-
extendDiscountReason: (_payload$_extend4 = payload._extend) === null || _payload$_extend4 === void 0 ? void 0 : _payload$_extend4.discount_reason,
|
|
109
|
-
originExtendDiscountReason: origin === null || origin === void 0 || (_extend3 = origin._extend) === null || _extend3 === void 0 ? void 0 : _extend3.discount_reason
|
|
110
|
-
});
|
|
111
|
-
var lineOriginalPrice = hasPriceOverride && Number.isFinite(originTotal) ? toPriceString(originTotal) : lineCompositeTotal;
|
|
112
|
-
var manualDiscountList = shouldBuildManualProductDiscount({
|
|
113
|
-
hasPriceOverride: hasPriceOverride,
|
|
114
|
-
originTotal: originTotal,
|
|
115
|
-
sellingTotal: sellingTotal
|
|
116
|
-
}) ? mergeManualProductDiscountIntoList(payload.discount_list, buildManualProductDiscountItem({
|
|
117
|
-
originTotal: Number.isFinite(originTotal) ? originTotal : Number(lineOriginalPrice),
|
|
118
|
-
sellingTotal: Number.isFinite(sellingTotal) ? sellingTotal : Number(lineCompositeTotal),
|
|
119
|
-
quantity: resolvedQuantity,
|
|
120
|
-
message: discountReason,
|
|
121
|
-
discountway: (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.discountway,
|
|
122
|
-
discount_per: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discount_per
|
|
123
|
-
})) : payload.discount_list || [];
|
|
124
|
-
var metadata = _objectSpread(_objectSpread({
|
|
83
|
+
var metadata = {
|
|
125
84
|
unique: payload.unique,
|
|
126
85
|
session: payload.session,
|
|
127
86
|
form: payload.form,
|
|
@@ -132,15 +91,8 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
132
91
|
policy_id: payload.policy_id,
|
|
133
92
|
source_shop_id: payload.source_shop_id,
|
|
134
93
|
origin: origin,
|
|
135
|
-
source_product_price: sourceProductPrice
|
|
136
|
-
|
|
137
|
-
main_product_original_price: sourceProductPrice
|
|
138
|
-
}, hasPriceOverride ? {
|
|
139
|
-
price_override: String(payload.price_override),
|
|
140
|
-
is_manual_discount: 1
|
|
141
|
-
} : {}), payload.bundle_edit !== undefined ? {
|
|
142
|
-
bundle_edit: payload.bundle_edit
|
|
143
|
-
} : {});
|
|
94
|
+
source_product_price: sourceProductPrice
|
|
95
|
+
};
|
|
144
96
|
if (uniqueIdentificationNumber) {
|
|
145
97
|
metadata.unique_identification_number = String(uniqueIdentificationNumber);
|
|
146
98
|
}
|
|
@@ -148,15 +100,13 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
148
100
|
product_id: productId,
|
|
149
101
|
product_variant_id: productVariantId,
|
|
150
102
|
unique_identification_number: uniqueIdentificationNumber ? String(uniqueIdentificationNumber) : undefined,
|
|
151
|
-
num:
|
|
103
|
+
num: toSafePositiveInt((_payload$quantity = payload.quantity) !== null && _payload$quantity !== void 0 ? _payload$quantity : payload.num, 1),
|
|
152
104
|
product_option_item: productOptionItem,
|
|
153
105
|
product_bundle: productBundle,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
tax_fee: toPriceString((_ref29 = (_ref30 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref30 !== void 0 ? _ref30 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref29 !== void 0 ? _ref29 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
|
|
159
|
-
is_charge_tax: toNumber((_ref31 = (_ref32 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref32 !== void 0 ? _ref32 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref31 !== void 0 ? _ref31 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
|
|
106
|
+
selling_price: sourceProductPrice,
|
|
107
|
+
original_price: sourceProductPrice,
|
|
108
|
+
tax_fee: toPriceString((_ref16 = (_ref17 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref17 !== void 0 ? _ref17 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
|
|
109
|
+
is_charge_tax: toNumber((_ref18 = (_ref19 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
|
|
160
110
|
metadata: metadata,
|
|
161
111
|
note: payload.note != null ? String(payload.note) : '',
|
|
162
112
|
_origin: _objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
@@ -5,8 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
|
-
import { composeLinePrice, createUuidV4,
|
|
9
|
-
import { ensureManualProductDiscountList } from "../../modules/Order/utils/manualProductDiscount";
|
|
8
|
+
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* 构建金额全为 0 的空 summary。
|
|
@@ -107,42 +106,17 @@ export function isSkuOnlyDeleteIdentity(x) {
|
|
|
107
106
|
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
108
107
|
*/
|
|
109
108
|
export function normalizeOrderProduct(product) {
|
|
110
|
-
var _product$metadata, _metadata$origin,
|
|
109
|
+
var _product$metadata, _metadata$origin, _variantList$find, _product$is_charge_ta;
|
|
111
110
|
var metadata = _objectSpread({}, product.metadata || {});
|
|
112
111
|
// 不透明 identity 契约:每条订单行必须带 identity_key。
|
|
113
112
|
// 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
|
|
114
113
|
var resolvedIdentityKey = (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
115
114
|
metadata.unique_identification_number = resolvedIdentityKey;
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
var bundleInput = product.product_bundle || [];
|
|
119
|
-
if (priceOverride !== undefined && priceOverride !== null && priceOverride !== '' && Array.isArray(originOtherBundle) && originOtherBundle.length > 0) {
|
|
120
|
-
var priceById = new Map();
|
|
121
|
-
originOtherBundle.forEach(function (item) {
|
|
122
|
-
var _item$price2;
|
|
123
|
-
if ((item === null || item === void 0 ? void 0 : item.id) == null) return;
|
|
124
|
-
var unit = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.bundle_selling_price;
|
|
125
|
-
if (unit === undefined || unit === null) return;
|
|
126
|
-
priceById.set(String(item.id), String(unit));
|
|
127
|
-
});
|
|
128
|
-
var base = Array.isArray(bundleInput) && bundleInput.length > 0 ? bundleInput : originOtherBundle;
|
|
129
|
-
bundleInput = base.map(function (item) {
|
|
130
|
-
var unit = priceById.get(String(item === null || item === void 0 ? void 0 : item.id));
|
|
131
|
-
if (unit === undefined) return item;
|
|
132
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
133
|
-
price: unit,
|
|
134
|
-
bundle_selling_price: unit
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
var normalizedBundle = bundleInput.map(function (item) {
|
|
139
|
-
var _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref2, _item$bundle_selling_, _ref3, _ref4, _item$price3, _ref5, _item$price_type, _ref6, _item$price_type_ext;
|
|
115
|
+
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
116
|
+
var _ref2, _item$bundle_selling_, _ref3, _ref4, _item$price2, _ref5, _item$price_type, _ref6, _item$price_type_ext;
|
|
140
117
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
141
|
-
bundle_id: (_item$bundle_id2 = item.bundle_id) !== null && _item$bundle_id2 !== void 0 ? _item$bundle_id2 : item.id,
|
|
142
|
-
bundle_product_id: (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id,
|
|
143
|
-
bundle_group_id: (_item$bundle_group_id = item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item.group_id,
|
|
144
118
|
bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00',
|
|
145
|
-
price: (_ref3 = (_ref4 = (_item$
|
|
119
|
+
price: (_ref3 = (_ref4 = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price) !== null && _ref4 !== void 0 ? _ref4 : item.bundle_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '0.00',
|
|
146
120
|
price_type: (_ref5 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref5 !== void 0 ? _ref5 : '',
|
|
147
121
|
price_type_ext: (_ref6 = (_item$price_type_ext = item.price_type_ext) !== null && _item$price_type_ext !== void 0 ? _item$price_type_ext : item.custom_price_type_ext) !== null && _ref6 !== void 0 ? _ref6 : ''
|
|
148
122
|
});
|
|
@@ -160,7 +134,7 @@ export function normalizeOrderProduct(product) {
|
|
|
160
134
|
// 6) 入参 selling_price(最末兜底,新添加路径 caller 只给 selling_price)
|
|
161
135
|
var isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === '2';
|
|
162
136
|
var variantId = Number(product.product_variant_id || 0);
|
|
163
|
-
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$
|
|
137
|
+
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant : null;
|
|
164
138
|
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
165
139
|
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
166
140
|
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
@@ -230,18 +204,6 @@ export function normalizeOrderProduct(product) {
|
|
|
230
204
|
bundle: normalizedBundle,
|
|
231
205
|
useOriginalBundle: true
|
|
232
206
|
});
|
|
233
|
-
var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
|
|
234
|
-
num: product.num,
|
|
235
|
-
metadata: metadata,
|
|
236
|
-
lineOriginalPrice: product.original_price
|
|
237
|
-
}, composedOriginalPrice);
|
|
238
|
-
var discountList = ensureManualProductDiscountList({
|
|
239
|
-
discountList: product.discount_list,
|
|
240
|
-
metadata: metadata,
|
|
241
|
-
originalPrice: finalOriginalPrice,
|
|
242
|
-
sellingPrice: composedSellingPrice,
|
|
243
|
-
quantity: getSafeProductNum(product.num)
|
|
244
|
-
});
|
|
245
207
|
return {
|
|
246
208
|
order_detail_id: product.order_detail_id || null,
|
|
247
209
|
product_id: product.product_id,
|
|
@@ -249,10 +211,10 @@ export function normalizeOrderProduct(product) {
|
|
|
249
211
|
product_variant_id: product.product_variant_id,
|
|
250
212
|
product_option_item: normalizedOptions,
|
|
251
213
|
selling_price: composedSellingPrice,
|
|
252
|
-
original_price:
|
|
214
|
+
original_price: composedOriginalPrice,
|
|
253
215
|
tax_fee: product.tax_fee || '0.00',
|
|
254
216
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
255
|
-
discount_list:
|
|
217
|
+
discount_list: product.discount_list || [],
|
|
256
218
|
product_bundle: normalizedBundle,
|
|
257
219
|
metadata: metadata,
|
|
258
220
|
note: product.note != null ? String(product.note) : ''
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BookingTicketCartView, BookingTicketProductCatalogView, BookingTicketState, IGetCustomerListParams, ICustomer, ILoadProductsParams, ILoadProductDetailParams, IScanResult } from './types';
|
|
3
3
|
import type { ProductData } from '../../modules';
|
|
4
|
-
import { type BookingContextConfig, type BookingContextDateInput, type BookingContextResource, type BookingContextResourceMap, type BookingContextState, type InitBookingContextParams, type LoadBookingConfigParams, type LoadBookingResourcesParams, type ResourceError, type BookingCalcContext } from '../../modules/BookingContext';
|
|
5
4
|
import type { OrderCustomerView } from '../../modules/Order/types';
|
|
6
5
|
import { BaseSalesImpl } from '../BaseSales';
|
|
7
|
-
import type { BaseSalesScanCodeResult } from '../BaseSales/types';
|
|
8
6
|
import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
|
|
9
7
|
import type { LoadSalesDetailParams } from '../../modules/Order/types';
|
|
10
|
-
import { AddProductDecideContext, AddProductRequiresDetailPayload } from './utils/addProductDecision';
|
|
11
|
-
import { type BuildCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildCacheItemFromOrderLine';
|
|
12
|
-
import { type BuildNormalProductCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine';
|
|
13
|
-
import type { AddProductBookingInput, OrderProduct, OrderProductIdentity, UpdateOrderProductParams } from '../../modules/Order/types';
|
|
14
8
|
export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
15
9
|
protected defaultName: string;
|
|
16
10
|
protected defaultVersion: string;
|
|
@@ -22,14 +16,10 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
22
16
|
private platform;
|
|
23
17
|
private scan;
|
|
24
18
|
private productCatalog;
|
|
25
|
-
private orderCustomerDiscountRefreshInFlight;
|
|
26
|
-
private orderCustomerDiscountRefreshCustomerId;
|
|
27
19
|
/**
|
|
28
|
-
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer
|
|
29
|
-
* bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
|
|
20
|
+
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer。
|
|
30
21
|
*/
|
|
31
22
|
protected getRegisteredModuleNames(): readonly string[];
|
|
32
|
-
protected getSubmitOrderSalesChannel(): string;
|
|
33
23
|
/**
|
|
34
24
|
* 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
|
|
35
25
|
* 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
|
|
@@ -44,14 +34,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
44
34
|
* 让现有 setActiveCustomer / getActiveCustomer 调用方零成本拿到详情态客户。
|
|
45
35
|
*/
|
|
46
36
|
loadSalesDetail(orderIdOrParams: number | string | LoadSalesDetailParams): Promise<ISalesDetail>;
|
|
47
|
-
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
48
|
-
private hydrateOrderCustomerFromScanDiscounts;
|
|
49
|
-
private getDiscountCustomerId;
|
|
50
|
-
private resolveCustomerByDiscountCustomerId;
|
|
51
|
-
private findCustomerById;
|
|
52
|
-
private normalizeCustomer;
|
|
53
|
-
private getRawCustomerId;
|
|
54
|
-
private hasUsableCustomerDetails;
|
|
55
37
|
/**
|
|
56
38
|
* 更新当前预约的 appointment_status。
|
|
57
39
|
*
|
|
@@ -204,19 +186,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
204
186
|
* 清空下单客户(协议字段 + snapshot)。
|
|
205
187
|
*/
|
|
206
188
|
clearOrderCustomer(): void;
|
|
207
|
-
/**
|
|
208
|
-
* 重置 tempOrder,并同步清空下单客户运行态。
|
|
209
|
-
*
|
|
210
|
-
* OrderModule.restoreOrder 会重建空单(customer_id 已为 null),但不会:
|
|
211
|
-
* - emit BookingTicket `onOrderCustomerChange`
|
|
212
|
-
* - 重置 CustomerModule.selectedCustomer(老路 getActiveCustomer)
|
|
213
|
-
*
|
|
214
|
-
* 因此在 super.restoreOrder 之后显式清客户,保证 SalesSdk / ticketBooking 订阅方与 tempOrder 一致。
|
|
215
|
-
*/
|
|
216
|
-
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
217
189
|
/** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
|
|
218
190
|
private buildOrderCustomerPayload;
|
|
219
|
-
private refreshDiscountConfigAfterOrderCustomerChange;
|
|
220
191
|
/**
|
|
221
192
|
* 获取客户分页信息
|
|
222
193
|
* @returns 分页信息
|
|
@@ -320,109 +291,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
320
291
|
* @returns 其他参数
|
|
321
292
|
*/
|
|
322
293
|
getOtherParams(): Promise<Record<string, any>>;
|
|
323
|
-
/** 拉取 board config 并写入 BookingContext。 */
|
|
324
|
-
loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
|
|
325
|
-
/** 拉取资源全集并写入 BookingContext。 */
|
|
326
|
-
loadBookingResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
|
|
327
|
-
/** 初始化 BookingContext(date + config + resources)。 */
|
|
328
|
-
initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
|
|
329
|
-
/** 当前 store 是否已具备与入参等价的 config / resources(无需再请求接口)。 */
|
|
330
|
-
isBookingContextReady(params?: InitBookingContextParams): boolean;
|
|
331
|
-
/** 写入 booking config(来源:`/core/board/management/config`)。 */
|
|
332
|
-
setBookingConfig(config: BookingContextConfig | null): void;
|
|
333
|
-
/** 读取当前 booking config。 */
|
|
334
|
-
getBookingConfig(): BookingContextConfig | null;
|
|
335
|
-
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
336
|
-
setResources(resources: BookingContextResource[] | null | undefined): void;
|
|
337
|
-
/** 读取资源全集(浅克隆)。 */
|
|
338
|
-
getResourcesOrigin(): BookingContextResource[];
|
|
339
|
-
/** 读取资源全集 map(id → resource)。 */
|
|
340
|
-
getResourcesOriginMap(): BookingContextResourceMap;
|
|
341
|
-
/** 写入当前选择的日期;支持 dayjs / Date / string。 */
|
|
342
|
-
setBookingDate(date: BookingContextDateInput): void;
|
|
343
|
-
/** 读取当前选择的日期(统一 string)。 */
|
|
344
|
-
getBookingDate(): string | null;
|
|
345
|
-
/** 读取 BookingContext 完整 store(调试 / 测试 / 透传给 SDK 使用)。 */
|
|
346
|
-
getBookingContextState(): BookingContextState;
|
|
347
|
-
/** 清空 BookingContext(切租户 / destroy 场景)。 */
|
|
348
|
-
clearBookingContext(): void;
|
|
349
|
-
/**
|
|
350
|
-
* 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
|
|
351
|
-
*/
|
|
352
|
-
private buildBookingCalcContext;
|
|
353
|
-
/**
|
|
354
|
-
* 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
|
|
355
|
-
* `extraResources` 用于把拖入未绑定的资源也展示出来。
|
|
356
|
-
*/
|
|
357
|
-
getResourcesForProduct(product: any, options?: {
|
|
358
|
-
extraResources?: Array<{
|
|
359
|
-
form_id: number | string;
|
|
360
|
-
id: number;
|
|
361
|
-
}>;
|
|
362
|
-
}): any[];
|
|
363
|
-
/**
|
|
364
|
-
* 拼装 cacheItem 的 _extend / _data(资源 / 容量 / timeObj),与 info2 `getProductExtend` 等价。
|
|
365
|
-
*/
|
|
366
|
-
getProductExtend(cacheItem: any, extra?: Partial<BookingCalcContext>): any;
|
|
367
|
-
/**
|
|
368
|
-
* 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
|
|
369
|
-
*/
|
|
370
|
-
getResourceErrors(resource: any, cacheItem: any): ResourceError[];
|
|
371
|
-
/**
|
|
372
|
-
* 拼装 addProductDecision 通用上下文(从 store 自取)。
|
|
373
|
-
*/
|
|
374
|
-
private buildAddProductCtx;
|
|
375
|
-
/**
|
|
376
|
-
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
377
|
-
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
378
|
-
*/
|
|
379
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
380
|
-
/** 规格弹窗 callback 后的第二段决策。 */
|
|
381
|
-
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
382
|
-
/**
|
|
383
|
-
* @deprecated 请用 `decideAddProduct`;`autoClose=true` 仅当 action=add。
|
|
384
|
-
*/
|
|
385
|
-
decideAutoClose(item: any, options?: Partial<AddProductDecideContext>): {
|
|
386
|
-
autoClose: boolean;
|
|
387
|
-
cacheItem?: any;
|
|
388
|
-
};
|
|
389
|
-
/** 替代 info2 `getIsEject`:商品是否需要弹窗(0/1)。 */
|
|
390
|
-
getIsEject(item: any, type?: 'select' | 'detail'): 0 | 1;
|
|
391
|
-
/** 仅 session 商品(无 variant/option/package)→ true。 */
|
|
392
|
-
getIsOnlySession(item: any): boolean;
|
|
393
|
-
/**
|
|
394
|
-
* 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
|
|
395
|
-
*/
|
|
396
|
-
buildRequiresDetailPayload(item: any, options?: Partial<AddProductDecideContext>): AddProductRequiresDetailPayload;
|
|
397
|
-
/**
|
|
398
|
-
* 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
|
|
399
|
-
* 内部会先拼 cacheItem,再走 cacheItemToBookingInput 严格协议对齐。
|
|
400
|
-
*/
|
|
401
|
-
transformDetailToProductAndBooking(input: {
|
|
402
|
-
item: any;
|
|
403
|
-
cacheItem?: any;
|
|
404
|
-
detailResult?: {
|
|
405
|
-
e: any;
|
|
406
|
-
extension_type?: any;
|
|
407
|
-
detail?: any;
|
|
408
|
-
};
|
|
409
|
-
options?: Partial<AddProductDecideContext>;
|
|
410
|
-
}): {
|
|
411
|
-
product: Partial<OrderProduct> & OrderProductIdentity;
|
|
412
|
-
booking?: AddProductBookingInput;
|
|
413
|
-
cacheItem: any;
|
|
414
|
-
};
|
|
415
|
-
/**
|
|
416
|
-
* 从已加车的 order line + booking 反查资源编辑抽屉所需的 cacheItem。
|
|
417
|
-
* 供 SalesSdk「编辑资源」等场景使用;字段语义与 buildCacheItemFromDetail 产出对齐。
|
|
418
|
-
*/
|
|
419
|
-
buildCacheItemFromOrderLine(input: BuildCacheItemFromOrderLineInput): Record<string, any>;
|
|
420
|
-
/**
|
|
421
|
-
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
422
|
-
*/
|
|
423
|
-
buildNormalProductCacheItemFromOrderLine(input: BuildNormalProductCacheItemFromOrderLineInput): Record<string, any>;
|
|
424
|
-
/** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
|
|
425
|
-
updateProductInOrder(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
|
|
426
294
|
/**
|
|
427
295
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
428
296
|
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|