@pisell/pisellos 2.3.51 → 2.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +7 -9
- package/dist/modules/Order/index.js +165 -140
- package/dist/modules/Order/types.d.ts +21 -12
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.js +32 -56
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +793 -907
- package/dist/solution/BaseSales/index.d.ts +15 -12
- package/dist/solution/BaseSales/index.js +194 -178
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -16
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +7 -9
- package/lib/modules/Order/index.js +89 -38
- package/lib/modules/Order/types.d.ts +21 -12
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.js +32 -44
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +0 -14
- package/lib/server/index.js +15 -72
- package/lib/solution/BaseSales/index.d.ts +15 -12
- package/lib/solution/BaseSales/index.js +52 -35
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -16
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/lib/solution/BookingTicket/index.js +2 -10
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1891
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -321,6 +321,24 @@ export interface ReplaceTempOrderOptions {
|
|
|
321
321
|
saveDraft?: boolean;
|
|
322
322
|
}
|
|
323
323
|
export type AddProductBookingInput = Record<string, any>;
|
|
324
|
+
/**
|
|
325
|
+
* 添加商品行时的顺序控制。
|
|
326
|
+
* 默认追加到 products 尾部;预约数量同步可插入到既有预约组的最新行之后,
|
|
327
|
+
* 避免步进器修改数量改变该组展示位置。
|
|
328
|
+
*/
|
|
329
|
+
export interface AddProductToOrderOptions {
|
|
330
|
+
insertAfterProductUid?: string;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* 删除商品后的可选位置保持策略。
|
|
334
|
+
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
335
|
+
*/
|
|
336
|
+
export interface RemoveProductsFromOrderOptions {
|
|
337
|
+
preserveDisplayPosition?: {
|
|
338
|
+
remainingProductUid: string;
|
|
339
|
+
anchorProductUid: string;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
324
342
|
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
325
343
|
export interface UpdateOrderProductParams {
|
|
326
344
|
product_id: number | null;
|
|
@@ -396,7 +414,6 @@ export interface CommitOrderParams {
|
|
|
396
414
|
type: 'virtual' | 'appointment_booking';
|
|
397
415
|
platform?: string;
|
|
398
416
|
extraData?: Record<string, any>;
|
|
399
|
-
business_code?: string;
|
|
400
417
|
};
|
|
401
418
|
}
|
|
402
419
|
export interface OrderSubmitBooking {
|
|
@@ -572,12 +589,6 @@ export interface SyncPaymentsToOrderParams {
|
|
|
572
589
|
payments: OrderPaymentSource[];
|
|
573
590
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
574
591
|
submitWhenPaid?: boolean;
|
|
575
|
-
/**
|
|
576
|
-
* Whether the checkout should be queued as the local `sync_sales` task.
|
|
577
|
-
* Defaults to true to preserve the WebPOS retry path. Set to false when
|
|
578
|
-
* the caller must wait for the cloud checkout response before proceeding.
|
|
579
|
-
*/
|
|
580
|
-
checkoutSyncTaskEnabled?: boolean;
|
|
581
592
|
smallTicketDataFlag?: number;
|
|
582
593
|
businessCode?: string;
|
|
583
594
|
channel?: string;
|
|
@@ -722,15 +733,15 @@ export interface OrderModuleAPI {
|
|
|
722
733
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
723
734
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
724
735
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
725
|
-
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput) => Promise<OrderProduct[]>;
|
|
736
|
+
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
726
737
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
727
738
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
728
739
|
updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
|
|
729
740
|
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
|
|
730
741
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
731
|
-
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
742
|
+
removeProductFromOrder: (identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
732
743
|
/** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
733
|
-
removeProductsFromOrder: (identities: OrderProductIdentity[]) => Promise<OrderProduct[]>;
|
|
744
|
+
removeProductsFromOrder: (identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
734
745
|
/** @deprecated no-op;OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
735
746
|
persistTempOrder: () => void;
|
|
736
747
|
/**
|
|
@@ -740,8 +751,6 @@ export interface OrderModuleAPI {
|
|
|
740
751
|
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
741
752
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
742
753
|
isTempOrderPersistEnabled: () => boolean;
|
|
743
|
-
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
744
|
-
notifyTempOrderChanged: () => void;
|
|
745
754
|
submitTempOrder: <T = any>(params?: {
|
|
746
755
|
cacheId?: string;
|
|
747
756
|
platform?: string;
|
|
@@ -63,6 +63,17 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
63
63
|
* 清空时整个 payload 为 null。
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* 添加商品行时的顺序控制。
|
|
68
|
+
* 默认追加到 products 尾部;预约数量同步可插入到既有预约组的最新行之后,
|
|
69
|
+
* 避免步进器修改数量改变该组展示位置。
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 删除商品后的可选位置保持策略。
|
|
74
|
+
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
75
|
+
*/
|
|
76
|
+
|
|
66
77
|
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
67
78
|
|
|
68
79
|
/** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
|
|
@@ -15,7 +15,6 @@ export interface OrderProductsDepositSummary {
|
|
|
15
15
|
deposit_policy_ids: number[];
|
|
16
16
|
hasDeposit: boolean;
|
|
17
17
|
}
|
|
18
|
-
import type { WindowPlugin } from '../../plugins';
|
|
19
18
|
/**
|
|
20
19
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
21
20
|
*
|
|
@@ -178,15 +177,6 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
178
177
|
form_id: number;
|
|
179
178
|
form_record_ids: number[];
|
|
180
179
|
}[];
|
|
181
|
-
export interface CartOrderHolder {
|
|
182
|
-
customer_id?: number;
|
|
183
|
-
form_id: number | string;
|
|
184
|
-
form_record: (number | string)[] | null;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
188
|
-
*/
|
|
189
|
-
export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
|
|
190
180
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
191
181
|
export { createUuidV4 };
|
|
192
182
|
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
@@ -20,7 +20,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
20
20
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
21
|
import dayjs from "dayjs";
|
|
22
22
|
import Decimal from 'decimal.js';
|
|
23
|
-
import { getProductHolderConfig } from "../Holder/utils";
|
|
24
23
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
25
24
|
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
26
25
|
/**
|
|
@@ -745,41 +744,10 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
|
|
|
745
744
|
return item.form_record_ids.length > 0;
|
|
746
745
|
}); // 过滤掉没有有效记录的表单
|
|
747
746
|
};
|
|
748
|
-
function getCustomerIdFromStorage(window) {
|
|
749
|
-
try {
|
|
750
|
-
var _window$getLocalStora;
|
|
751
|
-
var customer = JSON.parse((window === null || window === void 0 || (_window$getLocalStora = window.getLocalStorage) === null || _window$getLocalStora === void 0 ? void 0 : _window$getLocalStora.call(window, 'customer')) || '{}');
|
|
752
|
-
var customerId = Number(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
753
|
-
return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
|
|
754
|
-
} catch (_unused) {
|
|
755
|
-
return undefined;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
/**
|
|
760
|
-
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
761
|
-
*/
|
|
762
|
-
export function ensureCartItemOriginHolder(cartItem, window) {
|
|
763
|
-
var _cartItem$_origin, _cartItem$_productIni;
|
|
764
|
-
if (cartItem !== null && cartItem !== void 0 && (_cartItem$_origin = cartItem._origin) !== null && _cartItem$_origin !== void 0 && _cartItem$_origin.holder) {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
var holderConfig = getProductHolderConfig((_cartItem$_productIni = cartItem === null || cartItem === void 0 ? void 0 : cartItem._productInit) !== null && _cartItem$_productIni !== void 0 ? _cartItem$_productIni : cartItem === null || cartItem === void 0 ? void 0 : cartItem._productOrigin);
|
|
768
|
-
var formRecordId = cartItem === null || cartItem === void 0 ? void 0 : cartItem.holder_id;
|
|
769
|
-
if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.resource_id) || formRecordId == null) {
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
cartItem._origin.holder = {
|
|
773
|
-
customer_id: getCustomerIdFromStorage(window),
|
|
774
|
-
form_id: holderConfig.resource_id,
|
|
775
|
-
form_record: [formRecordId]
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
;
|
|
779
747
|
export var getAllDiscountList = function getAllDiscountList(cartItem) {
|
|
780
|
-
var _cartItem$
|
|
781
|
-
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$
|
|
782
|
-
((cartItem === null || cartItem === void 0 || (_cartItem$
|
|
748
|
+
var _cartItem$_origin, _cartItem$_origin2;
|
|
749
|
+
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin = cartItem._origin) === null || _cartItem$_origin === void 0 || (_cartItem$_origin = _cartItem$_origin.product) === null || _cartItem$_origin === void 0 ? void 0 : _cartItem$_origin.discount_list) || [];
|
|
750
|
+
((cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.product_bundle) || []).forEach(function (item) {
|
|
783
751
|
discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
784
752
|
item.discount_list = undefined;
|
|
785
753
|
});
|
|
@@ -157,10 +157,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
157
157
|
userPlugin,
|
|
158
158
|
customer_id,
|
|
159
159
|
_userPlugin$get,
|
|
160
|
-
channelMap,
|
|
161
|
-
rawApplicationCode,
|
|
162
|
-
mappedApplicationCode,
|
|
163
|
-
queryPayload,
|
|
164
160
|
productsData,
|
|
165
161
|
sortedList,
|
|
166
162
|
_args4 = arguments;
|
|
@@ -189,16 +185,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
189
185
|
console.error(error);
|
|
190
186
|
}
|
|
191
187
|
// 如果没传schedule_date,则从
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
scan_to_order: 'online-store',
|
|
195
|
-
'scan-to-order': 'online-store',
|
|
196
|
-
scan_to_order_2: 'mobile_order',
|
|
197
|
-
scan_to_order_3: 'scantoorder3'
|
|
198
|
-
};
|
|
199
|
-
rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
|
|
200
|
-
mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
201
|
-
queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
188
|
+
_context4.next = 7;
|
|
189
|
+
return this.request.post("/product/query", {
|
|
202
190
|
open_quotation: 1,
|
|
203
191
|
open_bundle: 0,
|
|
204
192
|
exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
|
|
@@ -206,35 +194,28 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
206
194
|
status: status,
|
|
207
195
|
num: 500,
|
|
208
196
|
skip: 1,
|
|
209
|
-
customer_id: customer_id
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
collection: collection
|
|
216
|
-
} : {}), {}, {
|
|
217
|
-
front_end_cache_id: cacheId
|
|
218
|
-
}, Array.isArray(menu_list_ids) && menu_list_ids.length ? {
|
|
219
|
-
menu_list_ids: menu_list_ids
|
|
220
|
-
} : {}), {}, {
|
|
197
|
+
customer_id: customer_id,
|
|
198
|
+
category_ids: category_ids,
|
|
199
|
+
ids: product_ids,
|
|
200
|
+
collection: collection,
|
|
201
|
+
front_end_cache_id: cacheId,
|
|
202
|
+
menu_list_ids: menu_list_ids,
|
|
221
203
|
with_count: with_count,
|
|
222
204
|
// client_schedule_ids: schedule_ids,
|
|
223
205
|
schedule_date: schedule_date,
|
|
224
|
-
application_code:
|
|
206
|
+
application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel,
|
|
225
207
|
is_eject: 1,
|
|
226
208
|
with_schedule: with_schedule,
|
|
227
209
|
schedule_datetime: schedule_datetime,
|
|
228
|
-
extension_type: extension_type
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return this.request.post("/product/query", queryPayload, {
|
|
210
|
+
extension_type: extension_type,
|
|
211
|
+
strategy_context: strategy_context
|
|
212
|
+
}, {
|
|
232
213
|
osServer: true,
|
|
233
214
|
callback: options === null || options === void 0 ? void 0 : options.callback,
|
|
234
215
|
subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
|
|
235
216
|
customToast: function customToast() {}
|
|
236
217
|
});
|
|
237
|
-
case
|
|
218
|
+
case 7:
|
|
238
219
|
productsData = _context4.sent;
|
|
239
220
|
sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
|
|
240
221
|
return Number(b.sort) - Number(a.sort);
|
|
@@ -247,7 +228,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
247
228
|
// }
|
|
248
229
|
this.addProduct(sortedList);
|
|
249
230
|
return _context4.abrupt("return", sortedList);
|
|
250
|
-
case
|
|
231
|
+
case 11:
|
|
251
232
|
case "end":
|
|
252
233
|
return _context4.stop();
|
|
253
234
|
}
|
|
@@ -21,7 +21,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
21
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
22
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
23
23
|
*
|
|
24
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
24
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
25
25
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
26
26
|
* the requested productId wins.
|
|
27
27
|
*/
|
|
@@ -90,7 +90,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
90
90
|
res = _context2.sent;
|
|
91
91
|
list = (res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [];
|
|
92
92
|
list.sort(function (a, b) {
|
|
93
|
-
return
|
|
93
|
+
return a.sort - b.sort;
|
|
94
94
|
});
|
|
95
95
|
this.store.list = list;
|
|
96
96
|
case 9:
|
|
@@ -151,7 +151,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
151
151
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
152
152
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
153
153
|
*
|
|
154
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
154
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
155
155
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
156
156
|
* the requested productId wins.
|
|
157
157
|
*/
|
|
@@ -366,7 +366,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
366
366
|
var discountType = selectedDiscount.tag || selectedDiscount.type;
|
|
367
367
|
return selectedDiscount.isEditMode === true && selectedDiscount.isSelected === true && ['good_pass', 'discount_card', 'product_discount_card'].includes(discountType);
|
|
368
368
|
};
|
|
369
|
-
var
|
|
369
|
+
var resolveReapplyBookingDiscountPercent = function resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount) {
|
|
370
370
|
var _discount2;
|
|
371
371
|
if (!shouldReapplyBookingDiscount(originProduct, selectedDiscount)) return undefined;
|
|
372
372
|
var discountType = (selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.tag) || (selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.type);
|
|
@@ -438,8 +438,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
438
438
|
_id: product._id,
|
|
439
439
|
parentId: product._id,
|
|
440
440
|
quantity: product.quantity,
|
|
441
|
-
num: product.num
|
|
442
|
-
booking_id: product.booking_id
|
|
441
|
+
num: product.num
|
|
443
442
|
});
|
|
444
443
|
|
|
445
444
|
// 2. 展开 bundle 子商品
|
|
@@ -454,6 +453,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
454
453
|
bundleIndex: bundleIndex,
|
|
455
454
|
// 虚拟商品属性
|
|
456
455
|
price: Number(bundleItem.price || 0),
|
|
456
|
+
// 新增商品运行态通常带 _bundle_product_id;订单 hydrate 后只有
|
|
457
|
+
// bundle_product_id。Change time 必须兼容两种结构,否则 bundle
|
|
458
|
+
// 子项无法命中折扣卡的 limited_relation_product_data.product_ids。
|
|
457
459
|
id: (_ref3 = (_bundleItem$bundle_pr = bundleItem.bundle_product_id) !== null && _bundleItem$bundle_pr !== void 0 ? _bundleItem$bundle_pr : bundleItem._bundle_product_id) !== null && _ref3 !== void 0 ? _ref3 : bundleItem.product_id,
|
|
458
460
|
_id: "".concat(product._id, "_bundle_").concat(bundleIndex),
|
|
459
461
|
parentId: product._id,
|
|
@@ -463,7 +465,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
463
465
|
origin_total: new Decimal(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
|
|
464
466
|
original_price: bundleItem.original_price,
|
|
465
467
|
// 继承主商品属性
|
|
466
|
-
booking_id:
|
|
468
|
+
booking_id: product.booking_id,
|
|
467
469
|
discount_list: bundleItem.discount_list || []
|
|
468
470
|
});
|
|
469
471
|
});
|
|
@@ -988,8 +990,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
988
990
|
discount_product_id: discount.product_id
|
|
989
991
|
},
|
|
990
992
|
metadata: {
|
|
991
|
-
num: num
|
|
992
|
-
discount_rule_uncheck_flag: discount === null || discount === void 0 ? void 0 : discount.discount_rule_uncheck_flag
|
|
993
|
+
num: num
|
|
993
994
|
}
|
|
994
995
|
};
|
|
995
996
|
applicableProducts.push(productData);
|
|
@@ -1095,11 +1096,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1095
1096
|
if (isPersistedProduct && hasExistingWalletDiscount) {
|
|
1096
1097
|
if (flatItem.type === 'main') {
|
|
1097
1098
|
processedProductsMap.set(product._id, [originProduct]);
|
|
1098
|
-
} else {
|
|
1099
|
-
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1100
|
-
processed: true
|
|
1101
|
-
})]);
|
|
1102
1099
|
}
|
|
1100
|
+
// bundle 虚拟项没有携带完整的历史价格字段。这里不写入 processed map,
|
|
1101
|
+
// 重组阶段会直接保留原始 bundleItem,避免把 bundle_selling_price
|
|
1102
|
+
// 覆盖为未折扣的 price,导致已支付金额再次进入应付。
|
|
1103
1103
|
return;
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
@@ -1440,9 +1440,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1440
1440
|
amount = productAllocation.discountAmount;
|
|
1441
1441
|
productDiscountDifference = productAllocation.difference;
|
|
1442
1442
|
mainProductSellingPrice = Math.max(new Decimal(product.price).minus(amount).toNumber(), 0);
|
|
1443
|
-
} else if (
|
|
1443
|
+
} else if (resolveReapplyBookingDiscountPercent(originProduct, _selectedDiscount) !== undefined) {
|
|
1444
1444
|
// Change time 重套编辑态折扣卡时,历史 par_value 不是运行时折扣口径,优先使用后端快照里的 percent。
|
|
1445
|
-
var percent =
|
|
1445
|
+
var percent = resolveReapplyBookingDiscountPercent(originProduct, _selectedDiscount);
|
|
1446
1446
|
reapplyDiscountPercent = new Decimal(percent).toFixed(2);
|
|
1447
1447
|
mainProductSellingPrice = new Decimal(product.price || 0).mul(new Decimal(100).minus(percent)).div(100).toDecimalPlaces(2).toNumber();
|
|
1448
1448
|
amount = new Decimal(product.price).minus(mainProductSellingPrice).toNumber();
|
|
@@ -1485,8 +1485,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1485
1485
|
_num: isGoodPass ? 1 : product.num,
|
|
1486
1486
|
config: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.config,
|
|
1487
1487
|
metadata: _objectSpread(_objectSpread({
|
|
1488
|
-
num: 1
|
|
1489
|
-
discount_rule_uncheck_flag: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.discount_rule_uncheck_flag
|
|
1488
|
+
num: 1
|
|
1490
1489
|
}, productDiscountDifference !== undefined && {
|
|
1491
1490
|
product_discount_difference: productDiscountDifference
|
|
1492
1491
|
}), {}, {
|
|
@@ -1573,7 +1572,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1573
1572
|
metadata: {
|
|
1574
1573
|
// 🔥 使用拆分后的唯一 _id
|
|
1575
1574
|
custom_product_bundle_map_id: uniqueId,
|
|
1576
|
-
discount_rule_uncheck_flag: _selectedDiscount2 === null || _selectedDiscount2 === void 0 ? void 0 : _selectedDiscount2.discount_rule_uncheck_flag,
|
|
1577
1575
|
num: 1
|
|
1578
1576
|
},
|
|
1579
1577
|
_num: 1,
|
|
@@ -1605,12 +1603,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1605
1603
|
_id: "".concat(flatItem._id, "_split_rest"),
|
|
1606
1604
|
num: normalNum,
|
|
1607
1605
|
quantity: normalNum,
|
|
1608
|
-
discount_list:
|
|
1606
|
+
discount_list: [],
|
|
1609
1607
|
processed: true
|
|
1610
1608
|
}));
|
|
1611
1609
|
}
|
|
1612
1610
|
} else {
|
|
1613
|
-
var _selectedDiscount3$me, _selectedDiscount3$me2, _flatItem$parentProdu9;
|
|
1611
|
+
var _selectedDiscount3$me, _selectedDiscount3$me2, _reapplyDiscountPerce2, _flatItem$parentProdu9;
|
|
1614
1612
|
// 折扣卡:不拆分数量,直接应用
|
|
1615
1613
|
var _selectedDiscount3 = selectedDiscountCard || applicableDiscounts[0];
|
|
1616
1614
|
usedDiscounts.set(_selectedDiscount3.id, true);
|
|
@@ -1628,11 +1626,19 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1628
1626
|
var targetProductTotal;
|
|
1629
1627
|
var fixedAmountPerItem;
|
|
1630
1628
|
var _productDiscountDifference;
|
|
1629
|
+
var _reapplyDiscountPercent;
|
|
1631
1630
|
if (_isOrderLevel && _productAllocation) {
|
|
1632
1631
|
// order_level:使用预计算的单价折扣金额(已经是单价,无需再除以数量)
|
|
1633
1632
|
fixedAmountPerItem = _productAllocation.discountAmount;
|
|
1634
1633
|
_productDiscountDifference = _productAllocation.difference;
|
|
1635
1634
|
targetProductTotal = Math.max(new Decimal(_productOriginTotal).minus(fixedAmountPerItem).toNumber(), 0);
|
|
1635
|
+
} else if (resolveReapplyBookingDiscountPercent(originProduct, _selectedDiscount3) !== undefined) {
|
|
1636
|
+
// hydrate 后 par_value 可能是余额/原值(例如 3500),百分比口径以
|
|
1637
|
+
// 后端折扣快照 discount.percent 为准,与主商品重套逻辑保持一致。
|
|
1638
|
+
var _percent = resolveReapplyBookingDiscountPercent(originProduct, _selectedDiscount3);
|
|
1639
|
+
_reapplyDiscountPercent = new Decimal(_percent).toFixed(2);
|
|
1640
|
+
targetProductTotal = new Decimal(_productOriginTotal).mul(new Decimal(100).minus(_percent)).div(100).toDecimalPlaces(2).toNumber();
|
|
1641
|
+
fixedAmountPerItem = new Decimal(_productOriginTotal).minus(targetProductTotal).toNumber();
|
|
1636
1642
|
} else {
|
|
1637
1643
|
// item_level 或其他类型:使用原有逻辑
|
|
1638
1644
|
targetProductTotal = getDiscountAmount(_selectedDiscount3, _productOriginTotal, _productOriginTotal);
|
|
@@ -1653,13 +1659,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1653
1659
|
title: _selectedDiscount3.format_title,
|
|
1654
1660
|
original_amount: product.original_price,
|
|
1655
1661
|
product_id: product.id || product.product_id,
|
|
1656
|
-
percent: _selectedDiscount3.par_value,
|
|
1662
|
+
percent: (_reapplyDiscountPerce2 = _reapplyDiscountPercent) !== null && _reapplyDiscountPerce2 !== void 0 ? _reapplyDiscountPerce2 : _selectedDiscount3.par_value,
|
|
1657
1663
|
discount_product_id: _selectedDiscount3.product_id
|
|
1658
1664
|
},
|
|
1659
1665
|
metadata: _objectSpread({
|
|
1660
1666
|
// 🔥 使用唯一的 _id
|
|
1661
1667
|
custom_product_bundle_map_id: _uniqueId,
|
|
1662
|
-
discount_rule_uncheck_flag: _selectedDiscount3 === null || _selectedDiscount3 === void 0 ? void 0 : _selectedDiscount3.discount_rule_uncheck_flag,
|
|
1663
1668
|
num: product.num || 1
|
|
1664
1669
|
}, _productDiscountDifference !== undefined && {
|
|
1665
1670
|
product_discount_difference: _productDiscountDifference
|
|
@@ -1675,7 +1680,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1675
1680
|
processedItems.push(_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1676
1681
|
total: targetProductTotal,
|
|
1677
1682
|
price: new Decimal(_productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
|
|
1678
|
-
discount_list:
|
|
1683
|
+
discount_list: [_discountDetail2],
|
|
1679
1684
|
processed: true
|
|
1680
1685
|
}));
|
|
1681
1686
|
}
|
|
@@ -2150,7 +2155,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2150
2155
|
}, {
|
|
2151
2156
|
key: "checkPackageSubItemUsageRules",
|
|
2152
2157
|
value: function checkPackageSubItemUsageRules(discount, flatItem) {
|
|
2153
|
-
var _flatItem$product;
|
|
2154
2158
|
var limitedData = discount.limited_relation_product_data;
|
|
2155
2159
|
var usageRules = limitedData === null || limitedData === void 0 ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
2156
2160
|
var rules = ['original_price'].concat(_toConsumableArray((usageRules === null || usageRules === void 0 ? void 0 : usageRules.rules) || []));
|
|
@@ -2172,7 +2176,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2172
2176
|
filter = _ref17$filter === void 0 ? 0 : _ref17$filter;
|
|
2173
2177
|
var isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
2174
2178
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2175
|
-
var bundleMainProductId = (_flatItem$product = flatItem.product) === null || _flatItem$product === void 0 ? void 0 : _flatItem$product.product_id;
|
|
2176
2179
|
|
|
2177
2180
|
// 主商品直接可用
|
|
2178
2181
|
if (isMainProduct) {
|
|
@@ -2215,13 +2218,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2215
2218
|
if (!filter) {
|
|
2216
2219
|
isScopeValid = true;
|
|
2217
2220
|
} else {
|
|
2218
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
2221
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
2219
2222
|
}
|
|
2220
2223
|
}
|
|
2221
2224
|
|
|
2222
2225
|
// 包含套餐判断, products值兼容旧数据
|
|
2223
2226
|
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2224
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
2227
|
+
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
2225
2228
|
}
|
|
2226
2229
|
|
|
2227
2230
|
// 价格和套餐适用范围都符合,则可用
|
|
@@ -2271,42 +2274,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2271
2274
|
|
|
2272
2275
|
// 检查 rules
|
|
2273
2276
|
if (rules.length > 0) {
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
// 价格是否符合规则:原价或加价
|
|
2277
|
-
var _isPriceValid = _isOriginalPrice3 || _isMarkupPrice3;
|
|
2278
|
-
// 套餐适用范围校验
|
|
2279
|
-
var _isScopeValid = false;
|
|
2280
|
-
|
|
2281
|
-
// 排除套餐判断, product_all值兼容旧数据
|
|
2282
|
-
if (scopeType === 'all_packages' || scopeType === 'product_all') {
|
|
2283
|
-
// 所有套餐可用
|
|
2284
|
-
if (!filter) {
|
|
2285
|
-
_isScopeValid = true;
|
|
2286
|
-
} else {
|
|
2287
|
-
_isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
// 包含套餐判断, products值兼容旧数据
|
|
2292
|
-
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2293
|
-
_isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2294
|
-
}
|
|
2295
|
-
|
|
2296
|
-
// 价格和套餐适用范围都符合,则可用
|
|
2297
|
-
if (_isPriceValid && _isScopeValid) {
|
|
2277
|
+
// 检查原价
|
|
2278
|
+
if (_isOriginalPrice2 && rules.includes('original_price')) {
|
|
2298
2279
|
return true;
|
|
2299
2280
|
}
|
|
2300
2281
|
|
|
2301
|
-
// 检查原价
|
|
2302
|
-
// if (isOriginalPrice && rules.includes('original_price')) {
|
|
2303
|
-
// return true;
|
|
2304
|
-
// }
|
|
2305
|
-
|
|
2306
2282
|
// 检查加价
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2283
|
+
if (_isMarkupPrice2 && rules.includes('markup_price')) {
|
|
2284
|
+
return true;
|
|
2285
|
+
}
|
|
2310
2286
|
|
|
2311
2287
|
// 如果都不匹配,则不可用
|
|
2312
2288
|
return false;
|
|
@@ -64,19 +64,21 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
64
64
|
this.store.surchargeList = ((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList) || [];
|
|
65
65
|
this.store.summary = ((_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.summary) || createEmptySalesSummary();
|
|
66
66
|
this.surchargeListModuleName = ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.surchargeListModuleName) || 'surchargeList';
|
|
67
|
-
|
|
68
|
-
// if (!this.appPlugin) {
|
|
69
|
-
// throw new Error('SalesSummaryModule 需要 app 插件支持');
|
|
70
|
-
// }
|
|
71
|
-
if (this.request) {
|
|
67
|
+
if (this.appPlugin) {
|
|
72
68
|
_context.next = 10;
|
|
73
69
|
break;
|
|
74
70
|
}
|
|
75
|
-
throw new Error('SalesSummaryModule 需要
|
|
71
|
+
throw new Error('SalesSummaryModule 需要 app 插件支持');
|
|
76
72
|
case 10:
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
if (this.request) {
|
|
74
|
+
_context.next = 12;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
throw new Error('SalesSummaryModule 需要 request 插件支持');
|
|
79
78
|
case 12:
|
|
79
|
+
_context.next = 14;
|
|
80
|
+
return this.getSurchargeList();
|
|
81
|
+
case 14:
|
|
80
82
|
case "end":
|
|
81
83
|
return _context.stop();
|
|
82
84
|
}
|
|
@@ -190,11 +192,10 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
190
192
|
}, {
|
|
191
193
|
key: "getAppData",
|
|
192
194
|
value: function getAppData(key) {
|
|
193
|
-
var _this$appPlugin
|
|
194
|
-
var getData = (_this$appPlugin =
|
|
195
|
+
var _this$appPlugin$getDa, _this$appPlugin, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
|
|
196
|
+
var getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
195
197
|
if (typeof getData === 'function') return getData(key);
|
|
196
|
-
var app =
|
|
197
|
-
if (!app) return undefined;
|
|
198
|
+
var app = this.appPlugin.getApp();
|
|
198
199
|
var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
|
|
199
200
|
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
200
201
|
}
|
|
@@ -87,7 +87,13 @@ function getUnitOriginalTotal(product) {
|
|
|
87
87
|
function isGeneratedVoucherProduct(product) {
|
|
88
88
|
var record = product;
|
|
89
89
|
var metadata = (record === null || record === void 0 ? void 0 : record.metadata) || {};
|
|
90
|
-
|
|
90
|
+
var isGeneratedChild = metadata.parent_order_detail_id !== undefined || metadata.gift_card_type !== undefined;
|
|
91
|
+
if (isGeneratedChild) return true;
|
|
92
|
+
|
|
93
|
+
// `product_voucher` 既可能是当前购物车生成的零价子券,也可能是独立售卖的
|
|
94
|
+
// gift card。已有 order_detail_id 且没有 parent 标记的是后者,必须继续计价。
|
|
95
|
+
var isPersisted = (record === null || record === void 0 ? void 0 : record.order_detail_id) !== undefined && (record === null || record === void 0 ? void 0 : record.order_detail_id) !== null;
|
|
96
|
+
return (record === null || record === void 0 ? void 0 : record.extension_type) === 'product_voucher' && !isPersisted;
|
|
91
97
|
}
|
|
92
98
|
function buildSurchargeServiceItems(products) {
|
|
93
99
|
return products.map(function (product) {
|
|
@@ -11,12 +11,10 @@ export declare class ScanOrderLoggerModule extends BaseModule implements Module,
|
|
|
11
11
|
protected defaultName: string;
|
|
12
12
|
protected defaultVersion: string;
|
|
13
13
|
private store;
|
|
14
|
-
private window?;
|
|
15
14
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
16
15
|
setContext(context: ScanOrderLoggerContext): void;
|
|
17
16
|
setProvider(provider: ScanOrderLoggerProviderType): void;
|
|
18
17
|
setProviderConfig(providerConfig: ScanOrderLoggerProviderConfig): void;
|
|
19
|
-
private getCurrentHost;
|
|
20
18
|
private buildRecord;
|
|
21
19
|
addLog(params: ScanOrderLogInput): Promise<void>;
|
|
22
20
|
}
|