@pisell/pisellos 2.2.260 → 2.2.262
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/dataVariant/adapter.d.ts +1 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +15 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +25 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +1 -6
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +23 -13
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +30 -7
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +45 -2
- package/dist/modules/Order/index.js +1552 -926
- package/dist/modules/Order/types.d.ts +36 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +8 -3
- package/dist/modules/Order/utils.js +136 -56
- package/dist/modules/Rules/index.d.ts +4 -10
- package/dist/modules/Rules/index.js +63 -12
- package/dist/modules/Rules/types.d.ts +12 -2
- package/dist/modules/SalesSummary/index.d.ts +7 -3
- package/dist/modules/SalesSummary/index.js +67 -39
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +2 -1
- package/dist/modules/SurchargeList/index.d.ts +6 -4
- package/dist/modules/SurchargeList/index.js +62 -39
- package/dist/modules/SurchargeList/types.d.ts +6 -2
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +1365 -911
- package/dist/server/modules/order/index.d.ts +32 -7
- package/dist/server/modules/order/index.js +551 -464
- package/dist/server/modules/order/types.d.ts +4 -0
- package/dist/server/modules/products/index.d.ts +5 -1
- package/dist/server/modules/products/index.js +384 -315
- package/dist/server/modules/products/types.d.ts +4 -0
- package/dist/solution/BaseSales/index.d.ts +42 -2
- package/dist/solution/BaseSales/index.js +1416 -775
- package/dist/solution/BaseSales/types.d.ts +7 -1
- package/dist/solution/BaseSales/types.js +3 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +19 -7
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +20 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -0
- package/dist/solution/BookingTicket/index.js +212 -31
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +1 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +10 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +20 -1
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -2
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +23 -3
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +45 -2
- package/lib/modules/Order/index.js +720 -116
- package/lib/modules/Order/types.d.ts +36 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +8 -3
- package/lib/modules/Order/utils.js +104 -18
- package/lib/modules/Rules/index.d.ts +4 -10
- package/lib/modules/Rules/index.js +61 -9
- package/lib/modules/Rules/types.d.ts +12 -2
- package/lib/modules/SalesSummary/index.d.ts +7 -3
- package/lib/modules/SalesSummary/index.js +28 -11
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +2 -0
- package/lib/modules/SurchargeList/index.d.ts +6 -4
- package/lib/modules/SurchargeList/index.js +41 -21
- package/lib/modules/SurchargeList/types.d.ts +6 -2
- package/lib/server/index.d.ts +8 -0
- package/lib/server/index.js +336 -11
- package/lib/server/modules/order/index.d.ts +32 -7
- package/lib/server/modules/order/index.js +298 -189
- package/lib/server/modules/order/types.d.ts +4 -0
- package/lib/server/modules/products/index.d.ts +5 -1
- package/lib/server/modules/products/index.js +21 -0
- package/lib/server/modules/products/types.d.ts +4 -0
- package/lib/solution/BaseSales/index.d.ts +42 -2
- package/lib/solution/BaseSales/index.js +535 -108
- package/lib/solution/BaseSales/types.d.ts +7 -1
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +13 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -0
- package/lib/solution/BookingTicket/index.js +134 -8
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Discount } from '../../modules/Discount/types';
|
|
1
2
|
import { OrderModule, ProductList, QuotationModule, SalesSummaryModule, ScanOrderLoggerModule as BaseSalesLoggerModule, ScheduleModule } from '../../modules';
|
|
2
3
|
import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderConfig as BaseSalesLoggerProviderConfig, ScanOrderLoggerProviderType as BaseSalesLoggerProviderType } from '../../modules/ScanOrderLogger/types';
|
|
3
4
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
@@ -14,6 +15,7 @@ export declare const BaseSalesHookNames: {
|
|
|
14
15
|
readonly onCartValidationChanged: "onCartValidationChanged";
|
|
15
16
|
readonly onPaymentSyncStart: "onPaymentSyncStart";
|
|
16
17
|
readonly onPaymentSyncEnd: "onPaymentSyncEnd";
|
|
18
|
+
readonly onDepositPaymentSyncEnd: "onDepositPaymentSyncEnd";
|
|
17
19
|
};
|
|
18
20
|
export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSalesHookNames];
|
|
19
21
|
export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
|
|
@@ -84,6 +86,8 @@ export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
|
|
|
84
86
|
booking_uid?: string;
|
|
85
87
|
/** 多语言商品标题快照,随 tempOrder 提交到 checkout。 */
|
|
86
88
|
product_title?: BaseSalesLocalizedText;
|
|
89
|
+
/** 商品封面图快照,随 tempOrder 提交到 checkout。 */
|
|
90
|
+
product_cover?: string;
|
|
87
91
|
/**
|
|
88
92
|
* 行级扩展 metadata。价格相关的权威字段:
|
|
89
93
|
*
|
|
@@ -380,9 +384,11 @@ export interface BaseSalesLoggerRuntimeConfig {
|
|
|
380
384
|
}
|
|
381
385
|
export interface BaseSalesAddLogParams extends BaseSalesLogInput {
|
|
382
386
|
}
|
|
383
|
-
/** BaseSales.scanPromotionCode
|
|
387
|
+
/** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
|
|
384
388
|
export interface BaseSalesScanCodeResult {
|
|
385
389
|
isAvailable: boolean;
|
|
386
390
|
type?: 'server' | string;
|
|
387
391
|
unavailableReason?: 'time_limit' | string;
|
|
392
|
+
/** batchSearch 原始结果;isAvailable=false 时 discountList 可能未写入 store,Holder 补全需读此字段 */
|
|
393
|
+
scannedDiscountList?: Discount[];
|
|
388
394
|
}
|
|
@@ -9,7 +9,8 @@ export var BaseSalesHookNames = {
|
|
|
9
9
|
onRefresh: 'onRefresh',
|
|
10
10
|
onCartValidationChanged: 'onCartValidationChanged',
|
|
11
11
|
onPaymentSyncStart: 'onPaymentSyncStart',
|
|
12
|
-
onPaymentSyncEnd: 'onPaymentSyncEnd'
|
|
12
|
+
onPaymentSyncEnd: 'onPaymentSyncEnd',
|
|
13
|
+
onDepositPaymentSyncEnd: 'onDepositPaymentSyncEnd'
|
|
13
14
|
};
|
|
14
15
|
export function createBaseSalesHook(moduleName, hookName) {
|
|
15
16
|
return "".concat(moduleName, ":").concat(hookName);
|
|
@@ -36,4 +37,4 @@ export function createBaseSalesHook(moduleName, hookName) {
|
|
|
36
37
|
|
|
37
38
|
/** `/order/resource/occupy-detail` 单条 `occupy_details[i]` */
|
|
38
39
|
|
|
39
|
-
/** BaseSales.scanPromotionCode
|
|
40
|
+
/** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
|
|
@@ -245,9 +245,10 @@ export function mergeIdenticalPromotionCartLines(products) {
|
|
|
245
245
|
var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
246
246
|
var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
|
|
247
247
|
var noteSignature = getProductLineNoteSignature(line);
|
|
248
|
+
var lineMergeBoundary = getPromotionLineMergeBoundary(line);
|
|
248
249
|
var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
|
|
249
250
|
var orderDetailId = (_line$order_detail_id = line === null || line === void 0 ? void 0 : line.order_detail_id) !== null && _line$order_detail_id !== void 0 ? _line$order_detail_id : line === null || line === void 0 ? void 0 : line.orderDetailId;
|
|
250
|
-
var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, noteSignature, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
|
|
251
|
+
var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, noteSignature, lineMergeBoundary, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
|
|
251
252
|
var hitIndex = indexByKey.get(mergeKey);
|
|
252
253
|
if (hitIndex === undefined) {
|
|
253
254
|
indexByKey.set(mergeKey, merged.length);
|
|
@@ -423,6 +424,16 @@ function getProductLineNoteSignature(product) {
|
|
|
423
424
|
var uid = getOrderProductUid(product);
|
|
424
425
|
return uid ? "note:".concat(uid) : "note:".concat(normalizedNote);
|
|
425
426
|
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* 编辑订单时,历史行仍参与整车促销评估,但不能与本次新增行合并。
|
|
430
|
+
* 以历史行 uid 作为促销前后的行边界;新增行返回空边界,仍保留原有合并语义。
|
|
431
|
+
*/
|
|
432
|
+
function getPromotionLineMergeBoundary(product) {
|
|
433
|
+
var _product$metadata3;
|
|
434
|
+
if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.is_edit_for_runtime) !== true) return '';
|
|
435
|
+
return "edit:".concat(getOrderProductUid(product));
|
|
436
|
+
}
|
|
426
437
|
function isPersistedGeneratedVoucher(product) {
|
|
427
438
|
var _product$order_detail;
|
|
428
439
|
var orderDetailId = (_product$order_detail = product === null || product === void 0 ? void 0 : product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product === null || product === void 0 ? void 0 : product.orderDetailId;
|
|
@@ -463,17 +474,18 @@ export function buildConsolidateKeyForPromotion(item) {
|
|
|
463
474
|
var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
|
|
464
475
|
var fingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
|
|
465
476
|
var noteSignature = getProductLineNoteSignature(item);
|
|
477
|
+
var lineMergeBoundary = getPromotionLineMergeBoundary(item);
|
|
466
478
|
var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
|
|
467
479
|
var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
|
|
468
480
|
if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
|
|
469
481
|
var _item$product_variant;
|
|
470
|
-
return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, noteSignature, String(orderDetailId)].join('#');
|
|
482
|
+
return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, noteSignature, lineMergeBoundary, String(orderDetailId)].join('#');
|
|
471
483
|
}
|
|
472
484
|
if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
|
|
473
485
|
var _item$product_variant2;
|
|
474
|
-
return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, noteSignature, String(bookingUid)].join('#');
|
|
486
|
+
return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, noteSignature, lineMergeBoundary, String(bookingUid)].join('#');
|
|
475
487
|
}
|
|
476
|
-
return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint, noteSignature].join('#');
|
|
488
|
+
return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint, noteSignature, lineMergeBoundary].join('#');
|
|
477
489
|
}
|
|
478
490
|
function consolidateMainProductsForPromotion(entries) {
|
|
479
491
|
if (!Array.isArray(entries) || entries.length <= 1) {
|
|
@@ -838,13 +850,13 @@ export function resolveStrategyEligibleProducts(matched) {
|
|
|
838
850
|
export function calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts) {
|
|
839
851
|
var unfulfilledMap = new Map();
|
|
840
852
|
var _loop2 = function _loop2() {
|
|
841
|
-
var _product$
|
|
853
|
+
var _product$metadata4, _ref13, _product$_originalPro, _product$metadata5, _product$num2;
|
|
842
854
|
var product = processedProducts[i];
|
|
843
|
-
var promotion = product === null || product === void 0 || (_product$
|
|
855
|
+
var promotion = product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4._promotion;
|
|
844
856
|
if (!promotion || promotion.inPromotion !== false) return 0; // continue
|
|
845
857
|
var strategyId = promotion.strategyId;
|
|
846
858
|
if (!strategyId) return 0; // continue
|
|
847
|
-
var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$
|
|
859
|
+
var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
|
|
848
860
|
var originalIndex = mainProducts.findIndex(function (item) {
|
|
849
861
|
return getOrderProductUid(item) === lookupUid;
|
|
850
862
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 把 `/order/sales/{id}` 响应(OrderData)解析为 ISalesDetail。
|
|
3
3
|
*
|
|
4
4
|
* - 纯函数:不依赖任何运行时模块/插件,便于单测与 view-model 适配
|
|
5
|
-
* - products 保留 tempOrder /
|
|
5
|
+
* - products 保留 tempOrder / 后端详情原字段,仅规范化集合身份并浅拷贝,避免丢失 product_sku 等协议字段
|
|
6
6
|
* - bookings 平铺保留服务端原顺序,同时输出 byProductUid 反查表与 rootBooking
|
|
7
7
|
* - header 收敛"非数组顶层字段",便于 ticketBooking view-model 直接消费
|
|
8
8
|
*
|
|
@@ -130,7 +130,7 @@ export interface ISalesDetail {
|
|
|
130
130
|
customer: ISalesDetailCustomer | null;
|
|
131
131
|
/** 服务端 summary(仅输出) */
|
|
132
132
|
summary: Record<string, any>;
|
|
133
|
-
/**
|
|
133
|
+
/** 规范化后的响应快照,方便 UI 兜底使用 */
|
|
134
134
|
raw: Record<string, any>;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
@@ -138,7 +138,7 @@ export interface ISalesDetail {
|
|
|
138
138
|
*
|
|
139
139
|
* 注意:
|
|
140
140
|
* - 入参允许是 `{ data: OrderData }` 或直接 `OrderData`,自动识别。
|
|
141
|
-
* - products
|
|
141
|
+
* - products/bookings/payments 在此补齐集合身份;其余 runtime 字段由 OrderModule hydrate 负责。
|
|
142
142
|
* - 不做远程请求;不修改入参;返回新对象。
|
|
143
143
|
*/
|
|
144
144
|
export declare function parseSalesResponse(input: Record<string, any> | null | undefined): ISalesDetail;
|
|
@@ -11,7 +11,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
11
11
|
* 把 `/order/sales/{id}` 响应(OrderData)解析为 ISalesDetail。
|
|
12
12
|
*
|
|
13
13
|
* - 纯函数:不依赖任何运行时模块/插件,便于单测与 view-model 适配
|
|
14
|
-
* - products 保留 tempOrder /
|
|
14
|
+
* - products 保留 tempOrder / 后端详情原字段,仅规范化集合身份并浅拷贝,避免丢失 product_sku 等协议字段
|
|
15
15
|
* - bookings 平铺保留服务端原顺序,同时输出 byProductUid 反查表与 rootBooking
|
|
16
16
|
* - header 收敛"非数组顶层字段",便于 ticketBooking view-model 直接消费
|
|
17
17
|
*
|
|
@@ -23,6 +23,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
23
23
|
* - 不在此处发明等价关系;UI 侧(ticketBooking)若需要别的字段,由 view-model 适配层做转换
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
import { normalizeOrderCollections } from "../../../modules/Order/utils/orderCollectionIdentity";
|
|
26
27
|
/** OrderData 中除大数组外的"顶层 header 字段"白名单,按需扩展。 */
|
|
27
28
|
var HEADER_KEYS = ['order_id', 'order_number', 'shop_order_number', 'shop_full_order_number', 'type', 'business_code', 'platform', 'sales_channel', 'order_sales_channel', 'vouchers', 'status', 'payment_status', 'shipping_status', 'customer_id', 'customer_name', 'country_calling_code', 'phone', 'email', 'is_price_include_tax', 'tax_title', 'tax_country_code', 'currency_code', 'currency_symbol', 'currency_format', 'is_deposit', 'deposit_amount', 'shop_discount', 'surcharge_fee', 'note', 'schedule_date', 'created_at', 'updated_at', 'metadata', 'total_amount', 'shop_id', 'create_date', 'holder', 'relation_forms', 'contacts', 'contacts_info'];
|
|
28
29
|
function pickHeader(raw) {
|
|
@@ -108,19 +109,16 @@ function indexBookingsByProductUid(bookings) {
|
|
|
108
109
|
*
|
|
109
110
|
* 注意:
|
|
110
111
|
* - 入参允许是 `{ data: OrderData }` 或直接 `OrderData`,自动识别。
|
|
111
|
-
* - products
|
|
112
|
+
* - products/bookings/payments 在此补齐集合身份;其余 runtime 字段由 OrderModule hydrate 负责。
|
|
112
113
|
* - 不做远程请求;不修改入参;返回新对象。
|
|
113
114
|
*/
|
|
114
115
|
export function parseSalesResponse(input) {
|
|
115
|
-
var
|
|
116
|
+
var sourceRaw = input && _typeof(input) === 'object' && input.data && input.order_id == null ? input.data : input || {};
|
|
117
|
+
var raw = normalizeOrderCollections(sourceRaw).order;
|
|
116
118
|
var productsRaw = Array.isArray(raw === null || raw === void 0 ? void 0 : raw.products) ? raw.products : [];
|
|
117
|
-
var products = productsRaw.map(function (p
|
|
119
|
+
var products = productsRaw.map(function (p) {
|
|
118
120
|
var row = _objectSpread({}, p || {});
|
|
119
121
|
var metadata = row.metadata && _typeof(row.metadata) === 'object' ? _objectSpread({}, row.metadata) : {};
|
|
120
|
-
if (!metadata.unique_identification_number) {
|
|
121
|
-
var _row$product_id, _row$product_variant_;
|
|
122
|
-
metadata.unique_identification_number = "sales-product-".concat((_row$product_id = row.product_id) !== null && _row$product_id !== void 0 ? _row$product_id : 'unknown', "-").concat((_row$product_variant_ = row.product_variant_id) !== null && _row$product_variant_ !== void 0 ? _row$product_variant_ : 0, "-").concat(index);
|
|
123
|
-
}
|
|
124
122
|
delete metadata.price_schema_version;
|
|
125
123
|
delete row.identity_key;
|
|
126
124
|
return _objectSpread(_objectSpread({}, row), {}, {
|
|
@@ -30,6 +30,17 @@ function toPriceString(value) {
|
|
|
30
30
|
if (!Number.isFinite(parsedValue)) return fallback;
|
|
31
31
|
return parsedValue.toFixed(2);
|
|
32
32
|
}
|
|
33
|
+
function isBlankValue(value) {
|
|
34
|
+
return value === undefined || value === null || typeof value === 'string' && value.trim() === '';
|
|
35
|
+
}
|
|
36
|
+
function firstNonBlank() {
|
|
37
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
+
values[_key] = arguments[_key];
|
|
39
|
+
}
|
|
40
|
+
return values.find(function (value) {
|
|
41
|
+
return !isBlankValue(value);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
33
44
|
function normalizeOptionItems(optionItems) {
|
|
34
45
|
if (!Array.isArray(optionItems)) return [];
|
|
35
46
|
return optionItems.map(function (optionItem) {
|
|
@@ -66,7 +77,8 @@ function normalizeBundleItems(bundleItems) {
|
|
|
66
77
|
price: (_bundleItem$price3 = bundleItem.price) !== null && _bundleItem$price3 !== void 0 ? _bundleItem$price3 : unitStr,
|
|
67
78
|
bundle_selling_price: unitStr,
|
|
68
79
|
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,
|
|
69
|
-
option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option)
|
|
80
|
+
option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option),
|
|
81
|
+
discount_list: preferPriceField ? [] : bundleItem.discount_list
|
|
70
82
|
});
|
|
71
83
|
// bundle_selling_price 落「正净额」:markdown = |price| − Σoptions;markup/原价维持原值。
|
|
72
84
|
normalizedItem.bundle_selling_price = getBundleSellingMagnitude(magnitudeSource).toFixed(2);
|
|
@@ -105,7 +117,9 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
105
117
|
var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
|
|
106
118
|
var matchedVariant = (_ref15 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref15 !== void 0 ? _ref15 : findVariantById(origin, productVariantId);
|
|
107
119
|
var sourceProductPrice = toPriceString((_ref16 = (_ref17 = (_ref18 = (_ref19 = (_ref20 = (_ref21 = (_ref22 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref22 !== void 0 ? _ref22 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _ref21 !== void 0 ? _ref21 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref20 !== void 0 ? _ref20 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref17 !== void 0 ? _ref17 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price, '0.00');
|
|
108
|
-
var
|
|
120
|
+
var explicitLineTotal = (_ref23 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref23 !== void 0 ? _ref23 : (_payload$_extend = payload._extend) === null || _payload$_extend === void 0 ? void 0 : _payload$_extend.total;
|
|
121
|
+
var hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
|
|
122
|
+
var lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
|
|
109
123
|
var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
|
|
110
124
|
var productOptionItem = normalizeProductSkuOptions(normalizeOptionItems((_ref24 = (_ref25 = (_payload$product_sku$ = (_payload$product_sku = payload.product_sku) === null || _payload$product_sku === void 0 ? void 0 : _payload$product_sku.option) !== null && _payload$product_sku$ !== void 0 ? _payload$product_sku$ : payload.option) !== null && _ref25 !== void 0 ? _ref25 : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item));
|
|
111
125
|
var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride);
|
|
@@ -148,7 +162,7 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
148
162
|
mainPrice: 0,
|
|
149
163
|
bundle: productBundle
|
|
150
164
|
});
|
|
151
|
-
var derivedMainSelling = Number(lineCompositeTotal) - Number(bundleOnlyComposite);
|
|
165
|
+
var derivedMainSelling = hasExplicitLineTotal ? Number(lineCompositeTotal) - Number(bundleOnlyComposite) : Number(mainProductOriginalPrice);
|
|
152
166
|
var mainProductSellingPrice = toPriceString(Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice));
|
|
153
167
|
var metadata = _objectSpread(_objectSpread({
|
|
154
168
|
unique: payload.unique,
|
|
@@ -163,7 +177,8 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
163
177
|
source_product_price: sourceProductPrice,
|
|
164
178
|
main_product_selling_price: mainProductSellingPrice,
|
|
165
179
|
main_product_original_price: mainProductOriginalPrice,
|
|
166
|
-
price_schema_version: 2
|
|
180
|
+
price_schema_version: 2,
|
|
181
|
+
holder_config: sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.holder_config
|
|
167
182
|
}, hasPriceOverride ? {
|
|
168
183
|
price_override: String(payload.price_override),
|
|
169
184
|
is_manual_discount: 1
|
|
@@ -195,6 +210,7 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
195
210
|
metadata: metadata,
|
|
196
211
|
note: payload.note != null ? String(payload.note) : '',
|
|
197
212
|
product_title: productTitle,
|
|
213
|
+
product_cover: firstNonBlank(matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.cover, sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover),
|
|
198
214
|
_origin: _objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
199
215
|
callbackData: payload
|
|
200
216
|
})
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 3 | 5;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -551,6 +551,14 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
551
551
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
552
552
|
cover?: boolean;
|
|
553
553
|
}): Promise<void>;
|
|
554
|
+
private getDeviceTaskPlugin;
|
|
555
|
+
handlePrintWristband(params: {
|
|
556
|
+
voucher_ids: number[];
|
|
557
|
+
}): Promise<void>;
|
|
558
|
+
handleRedeem(params: {
|
|
559
|
+
voucher_ids: number[];
|
|
560
|
+
is_checkin: boolean;
|
|
561
|
+
}): Promise<any>;
|
|
554
562
|
/**
|
|
555
563
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
556
564
|
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|